perf: nested writes through a boxed container lowered as List.update #207
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Goal
self.tables[module].types.set(at, id)through a trait-typed list is a round trip (Index.at, the change,MutableIndex.set) with the element owned twice, so the change copies it. Answer it withList.update(index, change):ArrayListanswers it natively (unique storage, run the change through the element's address asPathStep.Elementdoes), the VM gets the same member, and the lowering writes a nested write through a still-boxed container as a call ofupdatewhose closure is the rest of the path.Design record
PERFORMANCE.md 9.6 ("A write through a trait-typed list"), BACKEND 2.3 (evaluation order: keys, then value, then access). Part of #144.
Acceptance criteria
at.ArrayList.updateand the VM member, with tests for order, out-of-range key and uniqueness (no copy of the element).removeAt/inserttake-out and put-back.sh tools/gates.sh aandbgreen in forge CI; before/after numbers in PERFORMANCE.md 9.7.Measurement
Measured in CI, no local bootstrap: the forge CI job for the PR runs
sh tools/gates.sh a; the before/after processor times come fromtorb check tests/conformance/adts.trb,torb build --emit-c tests/conformance/adts.trbandtorb build --emit-c ./compilerrun with themainbinary and the PR binary alternating (3 runs, mean, as in PERFORMANCE.md 9.5), printed in the CI log and copied into PERFORMANCE.md 9.7. CI machines are noisy, so the ratio of alternating runs counts, not absolute seconds.Seed impact
Yes: a new native and a name the lowering looks up. Lands in two commits per
CLAUDE.md"Seed and breaking changes" (teach both forms, refresh the seed, then migrate). Seed refresh is Torben's; this issue is blocked on the owner decision on #144 and is notready. Likely two PRs rather than one.[loop:torbscript] owner decision recorded (torben via WhatsApp, 2026-10-08 16:35 Europe/Berlin): go for this round (see #144). Two-commit seed rule applies. Labelled
ready.[loop:torbscript] claim implement by session:loop-torbscript-20261008 until 2026-10-08T23:09Z
PR #215 merged by argus (
fb36c465):ArrayList.update/TrieList.updateas plain TorbScript members, no native, no seed refresh needed. No post-merge step. Remaining for this issue: the IR pass after devirtualization that lowers a nested write through a still-boxed container asupdate; stays open. Open PR #217 is the throwaway count probe (WIP, to be closed).[loop:torbscript] release implement: worker session ended after PR #215 merged; the remaining IR pass is not started. The throwaway probe PR #217 is closed. next: implement (ready)
[loop:torbscript] claim implement by session:loop-torbscript-20261009 until 2026-10-09T05:04Z
Windowandwindows(CONCURRENCY slice F, gap 6) #4[loop:torbscript] implement: PR #238, CI success (
20872b48), next: review (waiting on the merge gate argus)The IR pass
ir/updates.trblowers a nested write through a list that stayed boxed as oneupdate(key, closure). It keeps the order of BACKEND 2.3, panics at the site with the message ofatwhen the key is out of range, and does no take-out and put-back. New conformance programslist-update-nestedandlist-update-boundsgive the same output asmain, andcompiler/tests/boxed-updates.test.trbsnapshots the lowered function and its closure. The measurement is in PERFORMANCE 9.11 (forge CI, 3 alternating runs): neutral within the noise for adts check/emit-c and the compiler emit-c. No new native and nostd/change, so no seed refresh. This releases the implement claim.Token usage: about 0.6M.