lunamark - markdown in lua using a PEG grammar

John MacFarlane jgm at berkeley.edu
Sat Sep 12 13:25:02 EDT 2009


+++ Yuri Takhteyev [Sep 12 09 03:20 ]:

> > As for performance, lunamark is about the same speed as PHP Markdown in

> > my tests.

>

> Is this with or without counting the time necessary to read the input?

> On my test, reading a wiki page of 500 words _once_ and then

> converting it 1000 times, lunamark is actually about 2.5 times faster

> than PHP Markdown.


That's nice to hear. My tests included reading the input, and also
expanding tabs, since PHP markdown does that. (But lunamark can
handle input with unexpanded tabs, so expanding tabs is not really
necessary.)


> But perhaps a comparison with the other two Lua options is more

> relevant. On the same benchmark, lunamark is 5-6 times faster than

> markdown.lua and 12-13 times slower than lua-discount. (Of course,

> lua-discount is basically a binding to a C implementation.)


That's about what I found too. discount is incredibly fast.
But the lunamark code is about 10x shorter, and should be easier
to extend and revise. It is also very portable, since both lua
and the lpeg library are written in ANSI C. So it might be useful for
some people.

John


More information about the Markdown-Discuss mailing list