You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Follow-on to #5334. That issue tracked making perry's IR efficient for large/untyped modules; its Tier 1 (outline the dynamic machinery) and Tier 2 (emit less scaffolding) levers all shipped:
This issue carries the one remaining lever, Tier 3 / Lever E: type-directed specialization — the strategic, long-term piece that #5334 explicitly deferred.
Goal
Where a value is statically a number / string / known-shape (real .ts, tsgo, or local inference), emit native ops instead of the dynamic form:
fadd / fmul / fcmp instead of js_add / js_rel_lt / IC guards
direct slot load/store instead of the inline-cache diamond
skip the nan-box round-trip entirely when the value never leaves a typed register
This attacks the two largest line-counts from #5334's measurement at the source — the 4.4M call @js_* and 365K js_typed_feedback_*_guard sites — rather than outlining them after the fact.
Context: surfaced taking the 13 MB @anthropic-ai/claude-code cli.js through perry. Tiers 1–2 made untyped bundles compilable; this is the typed-code performance frontier.
Follow-on to #5334. That issue tracked making perry's IR efficient for large/untyped modules; its Tier 1 (outline the dynamic machinery) and Tier 2 (emit less scaffolding) levers all shipped:
This issue carries the one remaining lever, Tier 3 / Lever E: type-directed specialization — the strategic, long-term piece that #5334 explicitly deferred.
Goal
Where a value is statically a number / string / known-shape (real
.ts,tsgo, or local inference), emit native ops instead of the dynamic form:fadd/fmul/fcmpinstead ofjs_add/js_rel_lt/ IC guardsThis attacks the two largest line-counts from #5334's measurement at the source — the 4.4M
call @js_*and 365Kjs_typed_feedback_*_guardsites — rather than outlining them after the fact.Why separate from #5334
Anyalmost everywhere, sostatic_type_ofrarely resolves, and Lever E barely moves the needle there. The bundle-compilability goal of codegen: IR is ~96x bloated for large/untyped modules (1.25GB / ~15GB clang RSS for a 13MB bundle) — outline dynamic machinery + specialize #5334 is already met by Tiers 1–2.Sketch
static_type_of/class_field_declared_typemachinery).f64ops, guarded only where the static type isnumber | undefined-ish.stringoperands → direct runtime calls without the dynamic dispatch..tsapp; hard constraint carried over from codegen: IR is ~96x bloated for large/untyped modules (1.25GB / ~15GB clang RSS for a 13MB bundle) — outline dynamic machinery + specialize #5334: no runtime perf regression on real code.Context: surfaced taking the 13 MB
@anthropic-ai/claude-codecli.js through perry. Tiers 1–2 made untyped bundles compilable; this is the typed-code performance frontier.