Coding and stuff

Benchmarking RDiscount

by Tim Felgentreff ,

The last benchmarks I posted, running Thin, were rather unfair against Rubinius (as Evan has pointed out). Time has passed in which I have been busy getting more specs to pass (only 8 failures and 2 errors are left) and I have found another gem with a benchmarking script for me to run ;) The RDiscount gem which implements Markdown in C.

I just ran rake build benchmark on Ree (2010.02), Rubinius (1.0.1 20100603) and the JRuby cext branch and got these numbers:

BlueCloth: 07.433000s total time 00.074330s average
RDiscount: 00.124000s total time 00.001240s average
Maruku: 11.619000s total time 00.116190s average

BlueCloth: 08.029169s total time 00.080292s average
RDiscount: 00.046740s total time 00.000467s average
Maruku: 06.500247s total time 00.065002s average

BlueCloth: 00.062746s total time 00.000627s average
RDiscount: 00.056345s total time 00.000563s average
Maruku: 21.178625s total time 00.211786s average

It’s clear how Ree is fastest with the C extension, but Rbx is not much behind. And even though JRuby’s cext implementation seems to be around 3 times slower for RDiscount than the other implementations, it’s still almost 60times faster than BlueCloth and around 90times faster than Maruku (compared to 1/171/139 on Ree and 1/1/375 on Rbx for RDiscount/BlueCloth/Maruku).

Also note how Ree is the only one where Maruku is actually fast and also how bloody fast BlueCloth runs on Rubinius!

So while the cext support for JRuby is comparatively slow, there are clearly cases where it might yield a performance gain.

This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Germany License. Any source code included is, unless stated otherwise, licensed under a MIT License. This does not apply for comments (below).