Fast-FFI is coming
Looks like V8 will soon have native FFI support (FFI calls will be JIT-compiled with the rest of the code like LuaJIT does). For now the relevant npm package Github repository is empty (lots of people from Google are watching it). Thought you might want to prepare or collaborate with them.
In some cases it may even be faster than NAN-based native modules (in theory, an FFI call to a really simple external C function could be JIT-compiled to just a call opcode with numbers already in registers just pushed to the stack as needed).
References:
https://github.com/nodejs/api/blob/master/ffi/FFI%20presentation%20%40%20VM%20summit.pdf
JIT generated bindings can be as fast as the current v8 marshalling approach in most scenarios, and may be faster on some scenarios.
https://docs.google.com/document/d/1D7-RBkuJiakADIWXOBVNyb6FNSXdoE3XIEXZ1axq97Q
Next steps:
- V8 to publish branch with Fast FFI implementation.
Yeah, I'm aware of this. Unfortunately I believe, that's still years away. And I was in need of a fast ffi module today.
However, once it gets landed, I'm gonna port fastcall's core from dyncall to fast-ffi, so everything should work as worked. Fast-ffi will be a low level stuff as I can tell right now, so there would be a place for high level abstractions. Also there would be a benefit in that for fastcall (and node-ffi) users the Fast-ffi upgrade will be an npm reinstall away.
https://medium.com/@nodejs/ibm-intel-microsoft-mozilla-and-nodesource-join-forces-on-node-js-48e21ffb697d#.6994az45c
The good new is that fastcall's C++ code is a very simple one, and porting it from Nan to NAPI would be fair easy.