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
private field access is ~1.5× public (residual after #11864/#11913/#11954) #11791
Private brand markers are stored as own keys on instances, so every instance of a class with #private members leaves the class's birth shape. Method calls on such instances then miss the class-shape fast path.
Cost: a method call on an instance of a class with private members is 7,540 instructions on main. A per-site extra-shape cache (shape-campaign method-call lane) brings it to 1,844, which works around the miss without removing the cause.
Fix (charter): make the private brand a shape fact, so the class's birth shape carries the brand, instead of an own key. Brand checks (#x in o, private field/method access) then compare the shape or its brand fact, and instances stay on the birth shape.
This lives in the class-template / birth-shape area that #11780 (template-owned final shapes for class objects and prototypes) builds. It will follow as its own PR on top of #11780.
Progress in #11864: private brands and private fields are now facts of the object shape (private rows 4–7× faster; tsc −0.06%, Zod +0.215%). Leaving open unless the author confirms this fully meets the issue's target.
More progress in #11913: private fields are typed slots of the class layout. private 447 → 331, field_rw 239 → 169, method_call 273 → 188 instructions; tsc flat, Zod −0.055%. The private row is still 1.5× public; leaving open.
Narrowing this issue's scope: the stated cause (the brand as an own key) is fixed by #11864 (private brands and fields are shape facts), #11913 (typed slots) and #11954 (a mint pays nothing for brands it doesn't carry). The gap tests test_gap_11791_* are on main.
Remaining: private field access is still about 1.5× the cost of public field access. This issue now tracks that gap.
changed the title [-]Private brands as own keys push every instance off the class birth shape (method calls 7.5k instructions)[/-][+]private field access is ~1.5× public (residual after #11864/#11913/#11954)[/+]on Oct 8, 2026
Activity
perf: private brands and private fields are facts of the object shape
proggeramlug commentedon Oct 4, 2026
Progress in #11864: private brands and private fields are now facts of the object shape (private rows 4–7× faster; tsc −0.06%, Zod +0.215%). Leaving open unless the author confirms this fully meets the issue's target.
proggeramlug commentedon Oct 4, 2026
More progress in #11913: private fields are typed slots of the class layout. private 447 → 331, field_rw 239 → 169, method_call 273 → 188 instructions; tsc flat, Zod −0.055%. The private row is still 1.5× public; leaving open.
perf: private fields are typed slots of the class layout
perf: own-key lookups read the private entry where they find the key
perf: a shape mint pays nothing for private brands it does not carry
proggeramlug commentedon Oct 8, 2026
Narrowing this issue's scope: the stated cause (the brand as an own key) is fixed by #11864 (private brands and fields are shape facts), #11913 (typed slots) and #11954 (a mint pays nothing for brands it doesn't carry). The gap tests test_gap_11791_* are on main.
Remaining: private field access is still about 1.5× the cost of public field access. This issue now tracks that gap.
[-]Private brands as own keys push every instance off the class birth shape (method calls 7.5k instructions)[/-][+]private field access is ~1.5× public (residual after #11864/#11913/#11954)[/+]