Markdown 1.0.2b4 Performance Drop

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

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

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

> as well as 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; considering how much of 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 id="foo">

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.


More information about the Markdown-Discuss mailing list