Markdown 1.0.2b4 Performance Drop

John Gruber gruber at fedora.net
Tue Aug 1 02:59:30 EDT 2006


John Gruber <gruber at fedora.net> wrote on 8/1/06 at 1:57 AM:


> I'm not entirely sure whether my current internal build performs

> as well as Markdown.pl 1.0.1, but I think it does.


Actually, I take that back. It looks like the Perl `Text::Balanced`
module makes use of the Perl global regex variable `$&`; this is
widely considered a no-no because using this variable (or one of its
friends, `` $` `` or `$'`) incurs a performance penalty on every
regex match in the program. See Friedl's "Mastering Regular
Expressions", 2nd Edition, pp. 357-258 for more info about this bug
in Perl.

`Text::Balanced` is the module I used for the basis of the new
block-tag parser in Markdown.pl; considering how much of
Markdown.pl is based on regex matching, it seems likely to me that
performance is going to be worse unless I abandon `Text::Balanced`.

This ties in to your other bug, Allan:

<div>
<div id="foo">
</div>
</div>

because it's `Text::Balanced` that is incorrectly parsing the tags
there. I'm not sure I want to fix this if I'm going to abandon
`Text::Balanced` anyway.

-J.G.


More information about the Markdown-Discuss mailing list