FFI vs C API performance w/o JIT enabled

  • From: "aaronbolyard ." <bolyard.aaron@xxxxxxxxx>
  • To: luajit@xxxxxxxxxxxxx
  • Date: Tue, 17 Feb 2015 04:51:53 -0500

Hello,

I'm currently developing a piece of software that may eventually be
built for platform(s) that do not permit JIT at some point in the
future, hence I'd have to use the interpreter only. Therefore, my idea
was to benchmark the various scenarios in which my code would be run
(with/without JIT, with/without FFI). I'm planning on implementing a
simple binding generator for the small subset of the API that needs
exposed to Lua, which should be easily re-targettable, so my results
are just for future reference.

The basic information I wanted was to know if the FFI is fast enough
without the JIT enabled. My results indicate that FFI is slower than
the C API in this particular case. Is this correct, or is my benchmark
flawed?

I have my benchmark and results available here in case I screwed up
somewhere: https://gist.github.com/aaronbolyard/644f5a8703cadba4fe59

The results, in either case, aren't that important because the Lua
code would not be in a performance critical loop or anything like
that. I'd just like to know how much I could get away with though,
writing Lua code instead of C++!

Thank you,

Aaron Bolyard

Other related posts: