Skip to content

fix: keep thread-local touches in accessors, and trim the cost the count work added - #1231

Merged
kacy merged 4 commits into
mainfrom
fix/share-spawn-cost
Oct 28, 2026
Merged

kacy merged 4 commits into
mainfrom
fix/share-spawn-cost

Conversation

@kacy

@kacy kacy commented Oct 28, 2026

Copy link
Copy Markdown
Owner

Follow-ups from a full before/after run of the reference-counting work against 37399c3.

  • Fix (main's CI): release_thread_tls from fix: release a task's threadlocal values when it finishes #1228 was inlined into the os-thread spawn closure, a frame that runs pith code, so it held the address of TLS_GLOBALS and check-tls-barriers failed. The touch moves behind an accessor of its own, as do the tracer buffer and the check mode's thread mark from perf: plain counts on structs only one task can reach #1230, and the barrier allowlist names them.
  • Function alignment: generated functions now start on a 64-byte boundary. tight_loop ran 50% slower after perf: keep read-only result locals on the stack, and skip boxing discarded results #1227 with identical machine code, because the larger program moved its loop across a line. Interleaved over the whole suite, the alignment takes tight_loop from 701 to 474 ms and lock_sweep/spawn from 283 to 254 ms; path_clean_count reads 5% slower, and the other rows are within 2%.
  • Allocation paths: the counters, the allocation census and the check mode's owner table were adding about 25 instructions to every struct allocation (the bookkeeping inlined, so the path saved registers it never used), about 10 to every list push, and a walk of all 16 closure slots to every spawn. They now sit behind one settled switch and cold calls, and a closure with no tagged slot is not walked. Under callgrind, task_churn went from 13.4% to 6.2% more instructions than 37399c3, and lock_sweep/spawn from 13.5% to 6.7%; what is left is the local-or-shared test on the release path.
  • The marking walk no longer allocates its work list unless there is a child to walk.

Gates, make rc-check-only and the collector tests all pass.

@kacy
kacy merged commit b0cccee into main Oct 28, 2026
2 checks passed
@kacy
kacy deleted the fix/share-spawn-cost branch October 28, 2026 05:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant