Repository navigation
test: measure the pool-backed allocation gates with the collector off - #103
Merged
Merged
Conversation
TestASizedLayerDoesNotAllocatePerPoint went red once on macOS, 108 allocations against 98, and was green on the rerun. GOGC=5 reproduces the same numbers on any machine: a collection during the twenty measured renders empties sync.Pool, and the next frame refills its pooled scratch. That refill is a real cost, and not the one the gate measures, which is whether a frame allocates per row. The gates over a render, a scene or a Build — the core's three helpers, three's overlay gate, geom's contour gate and stilus's redraw gate — now measure through allocsWithoutCollection: runtime.GC, then debug.SetGCPercent(-1) for the runs. Every allocation is still counted. They pass three times over at GOGC=1, 5 and 100. AGENTS.md records the rule beside the one-processor note. Fixes #101 Claude-Session: https://claude.ai/code/session_015BfhXWEPyCFY4fZhg5nzsh
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.
Fixes #101.
A collection during the measured runs empties
sync.Pool; the next frame refills its scratch.GOGC=5reproduces the CI failure exactly (108 vs 98).The gates over a render, a scene or a
Buildnow measure throughallocsWithoutCollection:runtime.GC(), thendebug.SetGCPercent(-1)for the runs. Every allocation is still counted — only the between-run pool loss is gone.Applied in:
allocgate_test.go(3 helpers),three/overlay_alloc_test.go,geom/contour_alloc_test.go,backend/stilus/alloc_test.go. Not instat/data: those gates measure caller-owned buffers, no pool.Verified: all gates pass
-count=3atGOGC=1,5and100(previously red at 5 and 1). AGENTS.md records the rule beside the one-processor note.Benchmarks (
allocgate.awk) are left as they are: they average over many iterations and their counts have been bit-identical sinceonOnePGate.https://claude.ai/code/session_015BfhXWEPyCFY4fZhg5nzsh