Markdown 1.0.2b4 Performance Drop

Michel Fortin michel.fortin at michelf.com
Sun Jul 30 16:34:42 EDT 2006


Le 29 juil. 2006 à 15:21, Allan Odgaard a écrit :


> I was recently made aware of the the Markdown 1.0.2 beta 4 and

> naturally downloaded it in great anticipation, as I am a big fan of

> Markdown :)

>

> Though I did notice a significant performance drop: The TextMate

> manual is 3,000 lines (173 KB) and previously took 4-5 seconds to

> convert to HTML (measuring only time spent by `Markdown.pl`.) With

> the new version this has increased to almost 30 seconds.


That's probably due to the new HTML block parser. It's clear that
iterating through all tags to balance them properly takes more time
than matching a regular expression based mostly on line indentation.

Surely the fact that Markdown.pl continuously repass Markdown-
generated markup through the HTML block parser does not help. I've
stopped doing that with PHP Markdown Extra and it shows in term of
performance.

PHP Markdown Extra, with its own balancing HTML block parser, is also
slower than plain PHP Markdown, but not by much. It shows the most
with documents which have a lot of HTML; in fact I suspect it to be
slower *only* when you have some HTML on the input, but I haven't
made any benchmark to verify that.


> Another problem is the new handling of embedded HTML (as block

> level tags.) Take this example:

>

> <div>

> <div id="foo">

> </div>

> </div>

>

> The markup for that ends up as:

>

> <div>

> <div id="foo">

> </div>

>

> <p></div></p>


I'll leave that bug to John.


Michel Fortin
michel.fortin at michelf.com
http://www.michelf.com/




More information about the Markdown-Discuss mailing list