colinsurprenant/bloombroom — pull request #1 by wmeissner (2013-02-26 06:36:38+00:00)
Title: Use :buffer_in and turn off errno saving to speed up passing string data via FFI

This (at least on my machine) makes JRuby 1.7.3 FFI almost as fast as ruby-2.0.0 with the cext (slower on 32, faster on 64):

benchmarking for 10000000 iterations
user system total real
JRuby:
ffi FNV 32: 6.610000 0.140000 6.750000 ( 6.879000)
ffi FNV 64: 6.280000 0.040000 6.320000 ( 6.540000)

MRI:
ffi FNV 32: 8.670000 0.030000 8.700000 ( 8.844798)
ffi FNV 64: 12.660000 0.050000 12.710000 ( 12.863284)
c-ext FNV 32: 5.560000 0.020000 5.580000 ( 5.641636)
c-ext FNV 64: 9.470000 0.030000 9.500000 ( 9.697421)

btw, when benchmarking JRuby, always use '--server' and bump up the iterations - ideally, do a million reps for warmup before running the actual benchmark.