Jake Zimmerman (@jez
)
Trevor Elliott (@elliottt
)
November 10, 2021
Sorbet
LLVM
the Sorbet Compiler
Why does Stripe care about performance?
Why build a compiler for Ruby?
How does it work?
How are we adopting it?
Why does Stripe care about performance?
Why build a compiler for Ruby?
How does it work?
How are we adopting it?
Stripe users want lower latency
Stripe API runs on every checkout
Why does Stripe care about performance?
Why build a compiler for Ruby?
How does it work?
How are we adopting it?
Powers our most important services (Stripe API)
Hundreds of engineers use Ruby daily
Millions of lines of code (monorepo)
Massive type coverage with Sorbet
No incremental migration
Compiler works with existing Ruby VM
AoT: ahead-of-time
JIT: just-in-time
Sorbet types speed up generated code
AoT are simpler (implement, debug)
Can still do both!
Why does Stripe care about performance?
Why build a compiler for Ruby?
How does it work?
How are we adopting it?
Compiler backend toolkit
Used by many compilers:
Clang, GHC (Haskell), Swift, …
rb_ary_collect
Why does Stripe care about performance?
Why build a compiler for Ruby?
How does it work?
How are we adopting it?
1️⃣ Plan for when things go wrong
2️⃣ Compare performance on real traffic
3️⃣ Must be incremental
Compiler test cases
Entire Stripe test suite
Pre-production (staging environment)
Blue/green deploys
Separate host set to kill traffic fast
→ Measure with Stackprof
📈 Increase adoption
(fraction running compiled)
⏱ Profile and optimize
(improve compiled performance)
btw, we have stickers!
also, we’re hiring!