Talks
Speakers
Events
Topics
Sign in
Home
Talks
Speakers
Events
Topics
Leaderboard
Use
Analytics
Sign in
Suggest modification to this talk
Title
Description
At Stripe, “make it faster!” is one of our most requested features, but we don’t want to have to pause work on other features to get speed. Instead, we’ve built an ahead-of-time compiler for Ruby, powered by Sorbet and LLVM, focusing on improving latency in Stripe’s multi-million line Ruby code base. In this talk, we’ll cover why we built it, how it works, and share preliminary results from compiling Stripe’s production Ruby code. It’s not quite ready for prime time yet, but we’re interested in sharing our approach and getting early feedback on the design.
Date
Summarized using AI?
If this talk's summary was generated by AI, please check this box. A "Summarized using AI" badge will be displayed in the summary tab to indicate that the summary was generated using AI.
Show "Summarized using AI" badge on summary page
Summary
Markdown supported
In the RubyConf 2021 talk titled "Compiling Ruby to Native Code with Sorbet & LLVM", Jake Zimmerman and Trevor Elliott from Stripe discuss their innovative approach to improving the performance of Ruby applications, particularly within Stripe's extensive codebase. They focus on developing an ahead-of-time compiler using Sorbet and LLVM aimed at enhancing the latency of their multi-million line Ruby codebase without disrupting ongoing feature development. ### Key Points Discussed: - **Motivation for Performance Improvement:** - Stripe's API is essential for various business operations involving money management, and faster APIs are preferred by developers. - Performance issues in Ruby code were identified as a significant factor in overall latency, necessitating an alternative approach to merely optimizing existing code. - **Sorbet as a Type Tracker:** - Sorbet is presented as a powerful tool for static typing in Ruby, which provides numerous long-term benefits and allows the compiler to leverage these type annotations for optimization. - **LLVM Overview:** - LLVM is introduced as a framework that simplifies compiler construction, making it easier to convert Ruby code into native code. - **The Compiler Architecture:** - The Sorbet compiler consists of a type checker and a code generator. It dynamically generates code in LLVM IR (intermediate representation), optimizing performance by taking advantage of known types. - An important feature is the ability to progressively integrate the compiler, allowing individual files to be compiled rather than requiring an all-or-nothing approach. - **Implementation and Optimizations:** - Examples of optimizations include checking type signatures, avoiding virtual machine dispatch, and inlining function calls to improve execution speed. - The transformation process from Ruby to efficient C-like constructs is outlined, showcasing how the original high-level code can be compiled into highly optimized native code. - **Deployment Strategy:** - The team discusses a careful rollout strategy to ensure minimal disruption, including extensive testing with existing codebases and a blue-green deployment strategy that allows for seamless transitions between old and new code. - By analyzing production performance data, the team can iteratively improve their compiler based on real-world metrics rather than relying solely on benchmarks. ### Conclusions: The talk concludes with the presenters emphasizing that the compiler not only enhances performance but does so while allowing developers to continue writing Ruby without worrying about the underlying complexities. The next steps involve increasing adoption across Stripe's codebase and refining the generated code further to achieve more performance gains.
Suggest modifications
Cancel