Benchmarks with TextMate's manual

John Fraser john at
Tue Aug 28 11:33:29 EDT 2007

On 8/28/07, Andrea Censi <andrea at> wrote:

> 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 agree that it's really hard to modify Markdown's syntax, and I
suspect that's part of what's been holding back its development. It's
one of the reasons I'd like JG to switch to an incremental parser.

But there are some big optimizations you can make to the Perl (and
apparently PHP) versions of Markdown pretty easily -- without changing
any syntax. Actually, I'll bet there's still some low-hanging fruit
left in Showdown, too. I'm just saying that when you compare the
performance of Maruku to the Perl and PHP versions, you're measuring
the implementations much more than the algorithms themselves.

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

I think that's a great solution, and I'd love to see Markdown
incorporate a simple, portable HTML parser. But that's a lot more
work than the other optimizations, so I don't think it's likely to get
done if performance is the only motivation. But if you borrowed
Michael's balanced-tags code, you could probably make five
to ten times faster with a few hours of work.

John Fraser

More information about the Markdown-Discuss mailing list