Since the start, TruffleRuby took a unique approach to support C (and C++) extensions: to interpret and just-in-time compile them. This gave some unique advantages like optimizing and inlining C and Ruby together in the JIT and being able to debug C and Ruby in a single debugger. However it also has some downsides including long warmup times (it takes a while to JIT compile all the C extension code), compatibility with huge C extensions (e.g. grpc) and slower installation of C extensions gems. In the last release, TruffleRuby changed the approach to run C extensions natively, like CRuby. In this talk, we would like to tell you this story, illustrate the challenges and discuss which parts of the C API could be improved. We also explore how to run C extensions faster by using “Inline caches in C”, which could also be applied in CRuby. Come and learn from 10 years of implementing and optimizing C extensions in various ways!
Schedule
Benoit Daloze is the TruffleRuby lead. He has contributed to many Ruby implementations, including CRuby, TruffleRuby and JRuby. He is the maintainer of ruby/setup-ruby and ruby/spec.