Repository navigation
Conversation
Two collector costs scaled with heap capacity rather than with live data. A major collection while the nursery held objects compacted the whole span up to oldCapacity + youngTop, including the untouched gap above the old fill. Its live-bit clear, offset pass, forwarding and packing all ran over every bitmap word. Such a major now evacuates the nursery first (an ordinary minor collection) and compacts only the packed old prefix. A nursery whose survivors cannot fit still compacts in place. The pages released afterwards are unchanged. Bitmap clears used fill, which stores element by element. The nursery's start bits (cleared every minor), the compactor's live bits and the dirty table now clear with set from a permanent zero block, one memmove per 2 KiB. Forced major with the nursery half full and 32 KB live, before -> after (measured on the Worker stream's branch, which shares this code): - 4 MiB nursery: 0.63 -> 0.16 ms; - 32 MiB nursery: 4.05 -> 0.50 ms; - 256 MiB nursery: 31.5 -> 2.35 ms. Twelve nurseries of minor-heavy churn: -3.3% at 32 MiB and -2.4% at 256 MiB. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The collector no longer has an 'if (minor) {' line: a collection now tests
whether the nursery fits the old prefix and evacuates it first. In collect
the young and old tops die at that evacuation call, so they stay in registers
the debug information does not describe, and LLDB cannot read them.
verify-heap-tools now breaks in evacuateNursery after its first call, where
both tops are homed and nothing has moved yet, as the old line was.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The per-phase breakdown found two collector costs that scaled with heap capacity. Fixing them takes a forced major with a half-full nursery from 31.5 to 2.35 ms at 256 MiB. Frozen v7 is neutral to better: cycles -0.9%, instructions -0.4% in every round. The allocating kernels are neutral or better except collections, at +2.3% cycles. Its allocator and collector time falls (median 15 to 8 ms per run), so the extra cycles are in unchanged mutator code that moved by one page. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Two generational collector costs scaled with heap capacity instead of live data. This PR removes both. Report: docs/results/collect-capacity-v1.md.
Changes
setfrom a permanent zero block instead of the element-by-elementfill.verify-heap-tools. It now breaks inevacuateNursery, where both tops are still readable. The oldif (minor)line is gone, and incollectthe tops are register-only at the new test.Results (macOS arm64)
Forced major, nursery half full (32 KB live):
Frozen v7 (15 paired rounds), neutral to better:
Allocating feature kernels (15 rotated rounds), cycles:
Collections. The kernel runs only minor collections. The profile puts its allocator and collector time at a median 15 ms per run on main and 8 ms with the fix. Instructions fall 0.4%, but cycles rise in unchanged mutator code, which moved by exactly one 4 KiB page because the runtime grew by one page. That is consistent with a placement effect, but not proven. The stacked #22 brings collections to about 1% below main.
Gates
verify-heap-tools: passes.The typed
fillcodegen improvement is left to the codegen stream (#17).🤖 Generated with Claude Code