Benchmarks with TextMate's manual
Andrea Censi
andrea at censi.org
Tue Aug 28 05:27:48 EDT 2007
On 8/28/07, John Fraser <john at attacklab.net> wrote:
> One implementation of the current Markdown algorithm can actually beat
> Maruku's time: [Showdown] is a straight JavaScript port of
> Markdown.pl, but it converts the TextMate in under 4 seconds (in
> Firefox, on an ancient machine).
Maruku's performance is as good as it can get, without writing some
part of it in C. It's Ruby that is slow.
> John Gruber's focus in the reference implementation has been on
> functionality -- not speed. That's good news, because it means
> there's a lot of room for improvement.
No, there isn't room for improvement. Because of the successive
regexps being applied over and over again, it's quite hard to make one
little change in the syntax without screwing up something down the
line.
If you have a parser, you know exactly what is the impact of any change you do.
> I didn't do any clever
> optimizations with Showdown; I just benchmarked, then fixed the
> glaring problems. It's not so easy to speed up the Perl version right
> now, because the dog-slow text::balanced parser would eclipse any
> simple fixes. But the PHP port shouldn't be hard too speed up. In
> fact, a good band-aid for the Perl version might be to backport
> Michael's variant of the old HTML parsing code -- which builds a big
> regexp to handle balanced tags up to four levels deep. (My gut tells
> me we can write a simple HTML parser that's even faster than that, and
> I'll take a crack at it as soon as I find the time.)
For Maruku, I wrote a very simple sub-parser for XML (which, in
addition, tries -- not very hard -- to fix tags soup). I would
recommend this as a temporary solution.
--
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