Require Hooks: Filling the Gap in Ruby's Extensibility
summary
Provides a concrete API called require_hooks that adds three hook types (around_load, source_transform, a full hijack_load) and runs on MRI and JRuby by choosing one of three injection strategies (kernel patch, undocumented load_is callback, or bootstrap-style hook). Runtime use in RubyNext, Friez, and Tapioca proves it works, but kernel-patch slows large boots (noticeable at ~12,000 files; JRuby shows regressions around 200 files). Also ships require_profiler to export SpeedScope flamegraphs and proposes core APIs for a proper loader namespace and loaded_features object.
AI-written summary · about
chapters (10)
- 0:00Introduction and motivation
- 3:00Ruby's flexibility and limitations
- 6:35Use cases for require hooks
- 10:30Code loading in other languages
- 14:05Introducing require hooks gem
- 15:29Implementation challenges
- 19:50Performance impact of hooks
- 23:46Proposed Ruby core improvements
- 26:15Future of Ruby's extensibility
- 27:38Require profiler demo
related talks
18mA Look at Hooks
28mIn the beginning, there was "require"...
44mrequire() bombed my multi-threaded app!
42mExtending Gems - Patterns and Anti-Patterns of Pluggable Gems
38mLong journey of Ruby standard library
39mRuby Next: make old Ruby quack like a new one
47mConstant autoloading in ruby on rails
51mOpening Day 3 Keynote
