Maruku: a better Markdown interpreter for Ruby.

Andrea Censi andrea at censi.org
Thu Dec 28 17:46:47 EST 2006



> Maruku looks very nice overall, but I have one comment and one

> question.

>

>



> Question:



> Have you benchmarked Maruku against BlueCloth? If so, how does it

> compare?


Just did it.

This is the benchmark I used:

http://rubyforge.org/viewvc/trunk/lib/maruku/tests/benchmark.rb?revision=27&root=maruku

The input data is

http://daringfireball.net/projects/markdown/syntax.text

These are the results on my Powerbook G4 (ruby 1.8.5, gcc 3.3):

BlueCloth (to_html): parsing 0.00 sec + rendering 2.16 sec = 2.17 sec
Maruku (to_html): parsing 1.83 sec + rendering 0.36 sec = 2.20 sec
Maruku (to_latex): parsing 1.87 sec + rendering 0.34 sec = 2.21 sec

These are the results on a Pentium 3 1.8ghz (ruby 1.8.5, gcc 3.4.3):

BlueCloth (to_html): parsing 0.00 sec + rendering 1.38 sec = 1.38 sec
Maruku (to_html): parsing 1.05 sec + rendering 0.25 sec = 1.29 sec
Maruku (to_latex): parsing 1.08 sec + rendering 0.20 sec = 1.28 sec

Considering that
1) for parsing, I am doing something very elegant to write but not the
more efficient thing.
2) for latex rendering, there are things very very inefficient.
3) I'm a novice ruby programmer so there are probably things done very stupidly
I guess that Maruku can be a 20-30% faster than Bluecloth if one
invests time in doing so. But at the moment, that's not my priority.

I was surprised to see it's already comparable in speed. :-D
Probably the magic is in the line-oriented parser: I'm using regexp
only for span-level elements.


> Comment:

>

> If you're going to support syntax extensions like PHP Markdown

> Extra's and MultiMarkdown's, you shouldn't call Maruku a Markdown

> interpreter. By default, "Markdown" should mean Markdown.

...

> The way Michel Fortin has handled this with PHP Markdown is ideal.


This deserves time to answer properly -- and in Italy it's time to bed.


--
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