How to load 1m lines of Ruby in 5s

*

See this talk at Open Source Bridge 2017! Register today!

Accepted Session
Short Form
Intermediate
Scheduled: Tuesday, June 20, 2017 from 1:30 – 2:15pm

Excerpt

How do you load code faster? Load less of it! I'll talk about how we used static analysis and aggressive refactoring to reduce the time to reload code after a change by 85%.

Description

Applications written in Ruby, Python and several other popular dynamic languages become very slow to boot as they grow to millions of lines of code. Waiting to reload code in development becomes a major frustration and drain on productivity. This talk will discuss how we reduced the time to boot a service at Stripe from 35s to 5s.

How do we load millions of lines of Ruby in seconds? We don’t! We statically analyze our codebase to determine which files define which constants (e.g. classes) and feed this information to Ruby’s autoloader so that code is only loaded as-need. To make this safe to roll out, we had to develop further static analysis tooling and refactor unanalyzable metaprogramming magic.

This talk will cover:

  • Why our Ruby code took forever to load and how it compares with similar languages.
  • The static analysis and code generation underlying our autoloader.
  • Techniques we used to execute massive refactors to make our code analyzable.

Speaking experience

Over 50 tech talks over the last 10 years. Lots of travel! My most interesting talk to give so far has been at PHPcon in 2014 in Japan. I had a translator with about 20% of the audience knowing English. When I would make a joke, 20% of the audience would laugh, and then the rest would wait with anticipation as the translator had to translate. Imagine getting a pre-laugh track to your favorite sitcom.

Speaker