Compiling Ruby to Native Code with Sorbet & LLVM
summary
Stripe builds an ahead‑of‑time compiler that takes Sorbet’s type‑checked control‑flow graph and emits LLVM IR to produce shared objects that call the Ruby C API, avoiding VM dispatch by inlining array/hash operations and blocks. Files opt in with a compiled sigil and the pipeline inserts runtime type assertions so LLVM can remove redundant checks. Rollout is incremental with test suites, staging, blue/green deploys, and observed production wins of 22–170% improvement on measured workloads using Sorbet and LLVM.
AI-written summary · about
chapters (13)
- 0:00Introduction
- 0:23Sorbet definition
- 1:40Agenda
- 3:46Speeding the API
- 5:55Alternative Ruby implementations
- 7:00LLVM vs JIT
- 8:39How Sorbet works
- 17:01Sorbet at Stripe
- 17:41Three main goals
- 18:18Line of defense
- 20:54Stack Prof
- 21:58Next Steps
- 22:44Questions
related talks
48mGradual typing for Ruby at Scale with Sorbet
39mGradual typing of Ruby at Scale
30mIntroducing Sorbet into your Ruby codebase
41mSorbet: A type checker for Ruby 3 you can use today!
39mRubyMotion under the Hood
33mAdopting Sorbet at Scale
31mStatic Type Checking in Rails with Sorbet
36mUsing Ruby for iOS development
