Type-based Gradual Typing Performance Optimization
summary
Implements discriminative typing that infers per-function types, duplicates each function into an optimized and a safe version, and uses variational typing plus subtyping-based cast insertion to call the fast variant when safe. Prototype in Reticulated Python (and ported to Grift) shows improvements on 95% of tested programs versus guarded Reticulated, with more than 4× speedup in >56% and 93% wins versus a prior optimizer (30% get 4–25×); preserves semantics and blame but raises compile-time and code-size costs.
AI-written summary · about
