BYOJ: Build your Own JIT, by Syed Faraaz Ahmad
Elevator pitch
Have you ever wondered how Ruby uses Just In Time (JIT) compilers to go faster? Ruby 3.3 has been released with a new JIT called RJIT. It is built in Ruby which enables us to easily hack on it and make our own!
Take a deep dive with me on Ruby’s JITs, how they work, and how you can make one too!
Content
This talk will first take us through a journey of Ruby’s performance over the years, culminating into a benchmark with and without JIT, then finally taking a deep dive into building your own JIT compiler from scratch.
A brief history of Ruby JITs:
- MJIT
- Yet Another JIT Compiler (YJIT)
- RJIT
Build your own JIT (Using RJIT)
- Instruction Sequence
- JIT compiling a nil statement
- JIT compiling an addition
- Benchmarks
- Bonus - Monkey-patching at the machine level