Quick bench of MRI Ruby 1.9.3-p392 vs 2.0.0-p0 vs JRuby 1.7.3 for computing 2000000 MD5, SHA-1 & FNV hashes.
The goal of this benchmark is mainly to compare the ffi vs c-ext performance.
A MBP with a 3GHz Intel Dual Core i7 and OSX 10.8.2 was used. Rubies managed with rbenv.
- MD5 & SHA-1 are part of the Ruby stdlib.
- native FNV is in pure Ruby.
- ffi FNV is in C and for the exception of the first unwarmed JRuby test, all are using :buffer_in in place of :string & :save_errno => false
- c-ext FNV is in C and only run in MRI
- the JRuby warming process is done on every hash test by running it once and then benchmarking the second.