What are the trade offs between ffi and mri c extensions in ruby?
Question
What are the trade offs between ffi and mri c extensions in ruby?
Solution
One obvious tradeoff is that MRI C extensions only work on MRI, whereas FFI extensions work on MRI, YARV, Rubinius and JRuby at the moment, and will in the future probably also work on IronRuby, MagLev, MacRuby, SmallRuby, tinyrb and RubyGoLightly.
OTHER TIPS
ffi is a tidge slower for method call invocation. Also ffi can't use any "native C" code unless you combine it with compilation, for example with ffi-inliner.
ffi is much more cross-VM friendly.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow