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
Found while counting executions at string-concat sites for the cc-performance
campaign. Filing rather than fixing, because it belongs to whoever owns #9514
and it bears on an attribution outside my lane.
Two independent measurements agree: the cache is not cold, it is not there
Runtime counter. I added a counter at the top of js_string_concat_site_value, before the slot lookup — so it counts calls, not
hits. One 400-character streamed reply through the offline mock-API rig, on the
compiled claude-code TUI:
js_string_concat and js_string_concat_chain are called ~8,600 times per
reply between them. js_string_concat_site_value is called zero times, in
three runs across two separately-compiled binaries.
Static check, which explains why. The symbol is not in the linked binary at
all:
Every other concat entry point is present; the site-cache one has been
dead-stripped, which it can only be if codegen emitted no call to it for
this module. So this is not a cache that misses — it is a cache with no call
sites in the workload.
(This is the same method that settled #9802: nm on the compiled object said
the outlined IC miss-handler was never referenced, and that turned out to be
the whole story there too.)
Why it is worth someone's time
A cache with no call sites cannot pay back its complexity — the CONCAT_SITE_SLOTS table, its GC lifecycle (gc/tests/concat_site.rs) and
the codegen pass are all carried for a path this workload never takes.
An attribution elsewhere may rest on it.bench_object_property beating
node was attributed to the per-site concat mechanism. That is a different
program and the mechanism may well fire there — but "it works" has now been
shown to be workload-dependent in a way nobody had measured, so the
benchmark deserves the same nm/counter check before the attribution is
relied on again.
Whether cc's concat sites should match. concat_site_cache.rs specialises prefix + <number> (its doc comment gives "field_" + j for j < 20), and I
have not characterised what cc's ~8,600 concatenations per reply actually look
like — they may legitimately all be string+string, in which case the answer is
"expected, and the cache is simply for other programs" and this issue closes as
working-as-intended with a note. The counter to settle it is a split of js_string_concat* calls by right-hand-side type.
Reproducing
PERRY_ENUM_DIAG=<path> on the branch of #9823 reports the counters above.
Binary: a full compile of cli_2.1.112.js from perf/for-in-deferred-shadow-set
(main c7361c87c + that diff), measured with secret-tests/cc-permission-harness/stream_scale.py at chunk 100, length 400.
Found while counting executions at string-concat sites for the cc-performance
campaign. Filing rather than fixing, because it belongs to whoever owns #9514
and it bears on an attribution outside my lane.
Two independent measurements agree: the cache is not cold, it is not there
Runtime counter. I added a counter at the top of
js_string_concat_site_value, before the slot lookup — so it counts calls, nothits. One 400-character streamed reply through the offline mock-API rig, on the
compiled claude-code TUI:
js_string_concatandjs_string_concat_chainare called ~8,600 times perreply between them.
js_string_concat_site_valueis called zero times, inthree runs across two separately-compiled binaries.
Static check, which explains why. The symbol is not in the linked binary at
all:
Every other concat entry point is present; the site-cache one has been
dead-stripped, which it can only be if codegen emitted no call to it for
this module. So this is not a cache that misses — it is a cache with no call
sites in the workload.
(This is the same method that settled #9802:
nmon the compiled object saidthe outlined IC miss-handler was never referenced, and that turned out to be
the whole story there too.)
Why it is worth someone's time
CONCAT_SITE_SLOTStable, its GC lifecycle (gc/tests/concat_site.rs) andthe codegen pass are all carried for a path this workload never takes.
bench_object_propertybeatingnode was attributed to the per-site concat mechanism. That is a different
program and the mechanism may well fire there — but "it works" has now been
shown to be workload-dependent in a way nobody had measured, so the
benchmark deserves the same
nm/counter check before the attribution isrelied on again.
strength of a measured admission gate, so either cc's concat shapes never
matched the specialisation, or something in codegen stopped matching them.
Those want different fixes and the counter above distinguishes them cheaply.
What I did NOT determine
Whether cc's concat sites should match.
concat_site_cache.rsspecialisesprefix + <number>(its doc comment gives"field_" + jforj < 20), and Ihave not characterised what cc's ~8,600 concatenations per reply actually look
like — they may legitimately all be string+string, in which case the answer is
"expected, and the cache is simply for other programs" and this issue closes as
working-as-intended with a note. The counter to settle it is a split of
js_string_concat*calls by right-hand-side type.Reproducing
PERRY_ENUM_DIAG=<path>on the branch of #9823 reports the counters above.Binary: a full compile of
cli_2.1.112.jsfromperf/for-in-deferred-shadow-set(main
c7361c87c+ that diff), measured withsecret-tests/cc-permission-harness/stream_scale.pyat chunk 100, length 400.https://claude.ai/code/session_014UZWia6L37DpA93VLtNK9m