How to load 1m lines of Ruby in 5s
summary
Claims 1m lines can boot in 5s instead of 35s by replacing broad requires with an autoloader backed by static analysis. The pipeline parses files with the parser gem, builds a definition tree, writes autoload stubs, stores caches in SQLite, and resolves constants (nesting + ancestry) while requiring gems and using const_get for unknowns. Migration bans const_set, ObjectSpace and class reopenings enforced by Rubocops; packages are enforced via packages.yaml. CI uses the dependency graph to run far fewer tests (25% of runs run <5% of tests).
AI-written summary · about
chapters (19)
- 0:00Intro
- 1:05The big challenge
- 2:00Ruby is slow
- 4:13Simple example
- 5:08Ruby Autoloader
- 6:37Static Analysis
- 9:48Nesting
- 11:32Ancestry
- 12:16Example
- 13:34Putting the pieces together
- 16:25Making it safe
- 16:46Autoloader problems
- 18:55Autoloader stub
- 23:03Reopening classes
- 25:31Selective test execution
- 26:30The Gordian knot
- 27:30Packages
- 28:32Typechecking
- 29:11Conclusion








