From Interpreting C Extensions to Compiling Them
summary
TruffleRuby implements C extensions three ways: interpreting C with Sulong (LLVM bitcode, inline across C↔Ruby) which yields up to ~3× speed when inlining but needs long warmup, and compiling extensions natively with clang which gives much faster startup and lets grpc and a 7,000‑line YAML parser run without JIT stalls. Tooling tradeoffs: JVM JNI/legacy FFI (lii) is slow, Java Panama is much faster. Claim: top‑10k gems have ~46% transitive native deps and TruffleRuby passes ~98% of C API specs.
AI-written summary · about
chapters (7)
- 0:00Introduction and speaker background
- 3:56Purpose and usage of C extensions
- 7:48Truffle framework and initial approach
- 15:18Transition to compiling C extensions
- 21:12Pros and cons of the extension API
- 24:02Performance benchmarks overview
- 30:28Conclusion and compatibility importance
related talks
35mRuby’s C Extension Problem and How We're Solving It
43mParallel and Thread-Safe Ruby at High-Speed with TruffleRuby
34mFaster FFI For Ruby
31mSimplifying and Optimizing Life on the Edge with Graal
42mImproving TruffleRuby’s Startup Time with the SubstrateVM
30mRuby’s Core Gem
24mJust-in-Time Compiling Ruby Regexps on TruffleRuby
57mRuby: 2020
