John MacFarlane says he has designed the CommonMark reference implementations (in C and JavaScript) to be fast.
I’ll let him explain.
I have designed the implementations to be fast – e.g. avoiding backtracking whenever possible. I have optimized them to the best of my ability, but I’m not a js or C wizard, so I’m sure they can still be improved.
I can give you some data on performance.
make benchjs
on my macbook air says:
std markdown → html x 226 ops/sec ±6.74% (88 runs sampled)
showdown.js markdown → html x 123 ops/sec ±1.22% (81 runs sampled)
marked.js markdown → html x 415 ops/sec ±0.76% (94 runs sampled)
So there may be room for improvement; but of course, marked isn’t as accurate a converter, so some of its speed may be due to short cuts it is taking.
My tests of the C implementation suggest that its performance is about the same as discount’s. For example, on my laptop it takes 0.03s (user) to convert a 179K manual. It seems to me that this should be fast enough. sundown is considerably faster, though, so again there may be room for improvement – though again, I worry that sundown achieves the performance by making many shortcuts that make proper parsing impossible. Anyway, I am sure C experts will be able to improve the performance quite a bit.