Benchmarks with TextMate's manual

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


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

> The following benchmarks have been obtained using the TextMate manual

> as the input source:

>

> <http://macromates.com/textmate/manual/source.tbz>

>

...

> 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 Markdown.pl 1.0.1 it takes 71 seconds. Beside

> the obvious speed difference between PHP Markdown and Markdown.pl

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

> neither PHP Markdown or Markdown.pl 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
Markdown.pl and PHP Markdown.

This is the same behaviour that I observed in Bluecloth (straight port
of Markdown.pl 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)
Web: http://www.dis.uniroma1.it/~censi


More information about the Markdown-Discuss mailing list