4 ms·
I'm also curious about C API access from JS. One thing I was hopeful about when I first read of Deno was ability to interop with native code by making FFI/bind
by gavinray 5y ago
I'm also curious about C API access from JS.
One thing I was hopeful about when I first read of Deno was ability to interop with native code by making FFI/bindings available in Rust, and then package to a native binary.
That didn't pan out, and I don't blame them, but I'm still hoping to be able to write native executables/shared libs in TypeScript and use C FFI.
- reilly3000 5y agoThis is way outside the realm of my expertise, but I’m curious how a FFI would be better than just calling child_process.exec for accessing a C binary. I suppose that may not be efficient inside of a game loop, but I don’t understand why, so long as it was done within a promise.
- MaxBarraclough 5y agoInter-process communication is much, much slower than a native function-call. (Native function calls are almost free, especially on modern CPUs which are very good at dealing with them.) Spinning up a whole new process is vastly slower still, taking (iirc) hundreds of thousands of instructions. > so long as it was done within a promise. I don't see how it would help things to wrap it up with concurrency abstractions. That won't make the cost go away.