Calling Functions Across Languages
summary
Demonstrates calling a Ruby dot product from Node.js by removing HTTP/IP C overhead and using C as intermediary with node_api.h and ruby.h to convert JS values to C then to Ruby and back, producing a direct same-process call that runs significantly faster than localhost IPC; benchmarks show under 8KB pipes fastest and >8KB favors shared memory. Notes risks (segfaults, mismatched in-memory representations, lost type checks) and tools to help: rust-bindgen and Rock glue generates bindings for Rust/Node to enable incremental TypeScript→Rock migration (used at vendor).
AI-written summary · about
chapters (11)
- 0:00Calling functions across languages
- 1:47Why cross-language calls are needed
- 8:25IPC and performance trade-offs
- 15:22How CPUs execute code as ones and zeros
- 19:31Risks of direct memory jumps
- 23:00C as intermediary for calls
- 29:56Same-process calls with low overhead
- 34:05Type safety challenges
- 37:15Generating bindings with Rock
- 43:10Speed versus safety balance
- 47:21Network, IPC, or same-process calls
related talks
48mCalling Functions Across Languages
48mOne VM To Rule Them All
01h 02mPolyglot Programming through Foreign Function Interfaces
35mOutperforming Imperative with Pure Functional Languages
46mMore Interops, Good and Varied!
31mSimplifying and Optimizing Life on the Edge with Graal
35mÀ la carte: mix and match C, Rust and Go!
44mKeynote
