Using Ruby to Generate Faster Ruby Code through Partial Evaluation
summary
Claims Ruby can generate faster Ruby by partial evaluation and presents a working source-to-source toolchain: a Ripper-based parser converts code to an internal AST, a RubyWRI term-rewriter does dataflow-style constant propagation and simple static method analysis, and a Shadow Boxing UNP pretty-printer emits Ruby. Current evaluator handles constant folding and whole-method specialization opportunities but skips intramethod partial evaluation, closures, dead‑code elimination and C‑library semantics. No general speed numbers yet; method analysis progress is imminent and benchmarks and Rails template use are explored.
AI-written summary · about
chapters (24)
- 0:00Introduction
- 0:56Who am I
- 1:37What is Partial Evaluation
- 2:49What is Constant Propagation
- 3:23What is Constant Folding
- 4:07What is Specialization
- 4:58Inlining
- 5:12Ruby Partial Evaluation
- 6:46Preserving Meaning
- 8:06Context Matters
- 9:24Determining the Receiver
- 10:13Determining Safety
- 11:59Data Flow Based Analysis
- 15:06Hybrid Method Analysis
- 17:48SourcetoSource Translation
- 19:04Parsing
- 19:42Analysis Transformation
- 21:24Example
- 25:24Unpark
- 26:36VAR Reference
- 27:47Work in Progress
- 30:44Next Steps
- 34:09More Information
- 37:14Questions








