ReviewOS

zig-utils/zig-gc

Perf: batch heap counter updates after sweeping dead cells

#23
Closed chris opened this 8 days ago ·
8 days ago

Consumer: zig-utils/zig-js#62\nRelated: #21\n\nMinor-GC profiling in zig-js is dominated by sweepPhaseLocked. The dead-cell branch currently mutates live_cells, bytes_live, young_cells, and young_bytes for every reclaimed cell, interleaved with binding calls that can inhibit keeping those fields in registers.\n\nAccumulate exact reclaimed/processed-young deltas in sweep-local counters and publish them once after the traversal. Preserve finalizer order, list unlinking, batch backing release, promotion/reclamation telemetry, full/minor behavior, underflow assertions, and binding semantics. Validate zig-gc tests plus the zig-js consumer benchmark/correctness/TSan gates.

8 days ago

Implemented and pushed to main as 9d4af0d (perf(gc): batch swept heap accounting (#23)). zig-gc is green at 37/37. Focused zig-js order-balanced A/B: direct +0.057 ms paired median (neutral); warmed 8 independent contexts -9.734 ms paired median, with exact checksums. Keeping this open until the consumer full/TSan/publication gates complete.

8 days ago

Completed by 9d4af0d and validated in zig-js publication 86d0c5b. Consumer gates: 766/766 normal unit tests; full TSan 765 passed, 1 expected skip, 0 failed/leaked; full 1,540-sample comparison passed. Focused order-balanced A/B was direct-neutral (+0.057 ms paired median) and 9.734 ms faster at eight warmed independent contexts.

Sign in to comment on this issue.