Benchmarks with TextMate's manual

Andrea Censi andrea at
Mon Aug 27 17:03:55 EDT 2007

On 8/27/07, Michel Fortin <michel.fortin at> wrote:

> The following benchmarks have been obtained using the TextMate manual

> as the input source:


> <>



> Now, the interesting part of the test: combining all the documents

> together and parsing them in one shot (352 Ko). With PHP Markdown it

> takes 29 seconds; with 1.0.1 it takes 71 seconds. Beside

> the obvious speed difference between PHP Markdown and

> (probably due to what I mentioned above), this test shows that

> neither PHP Markdown or scale well for big documents.

Maruku takes 8 seconds for parsing (on my PowerBook G4 1.5GHz).
(please note that Ruby, per se, is much slower than Perl)

I guess that if you plot [time for parsing] versus [length of the
document], you get a curve which grows more than linearly for and PHP Markdown.

This is the same behaviour that I observed in Bluecloth (straight port
of in Ruby) -- if I remember well, time was O(length^2).
By comparison, Maruku, and other real parsers, takes O(length).

At the time, I concluded that it was due to a naive implementation of
regexp substitution in Ruby. But I don't know much about regexps in
the end, and know even less about Perl and PHP, so I'll shut up and
ask you: what do you think this scaling problem is due to?

> I'll let you draw your own conclusions.

That we need a real grammar! and real parsers!

Andrea Censi
"Life is too important to be taken seriously" (Oscar Wilde)

More information about the Markdown-Discuss mailing list