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
{{ message }}
Repository navigation
Capture-by-reference for class-member var captures costs +22-24% on the shapes it fixes (#10485 follow-up) #10616
constructor writes to a function-nested class's captured var
+22.3%
static-method writes to the same shape
+24.8%
closure-heavy, no capture (control)
−0.04% (noise)
compile-time steady state (control)
+0.05% (noise)
The controls matter: the cost is confined to the shape the fix repairs, not spread across closures generally.
Why there is no valid "before" number
The baseline was faster because it silently skipped the write-back this fix performs — a var captured by a
class member fell back to a stale value-snapshot, so constructor and static-method writes were dropped entirely.
Measuring "the regression" against code that didn't do the work is measuring nothing.
This is the fourth instance of one pattern
Four correctness fixes in the package-audit campaign have landed with an instruction cost whose baseline was
invalid for the same reason — the old path was cheap because it was wrong:
Worth asking whether they share a cause: each replaces a wrong-but-cheap fast path with a correct path that
re-derives or re-resolves something per operation. If so, the same class of fix — resolve once and cache at the
call site, rather than per operation — may address several at once. #10414 is the precedent: Array.prototype.push
re-derived its receiver 6x per call, and fixing that was worth −74.6%.
Activity
class: fresh class instances are born linked from their template; fie…
proggeramlug commentedon Oct 4, 2026
Progress in #11940 (fresh-class evaluations), instructions per op: static method 5360 → 505, freshnew 9201 → 5846, ctor 13288 → 10686, evalnew 38121 → 27664; tsc −0.39% (fulls 76 = 76). Leaving open.
perf(class): captured-variable updates in class members take the dens…
perf(class): captured-variable updates in class members take the dens…