镜像站点 · 本页由第三方 GitHub 只读镜像提供,非 GitHub 官方站点,不接受任何登录或凭据输入。前往 github.com
Skip to content

Perf: reclaim GC slab slots with per-chunk free state #102

Closed

Description

@chrisbbreuer

Parent: #97
Related: #62, #101, zig-utils/zig-gc#17

Evidence

After bounded tail trimming (#101), direct and shared object_churn profiles still spent most nursery time in sweep and GcCellBacking.freeFn. The rejected zig-gc#17 experiment proved that batching allocator dispatch/size-class locks was neutral at the 8x100 publication load: per-cell ownership classification and writing/linking one intrusive FreeNode remained the real work.

Retained design

Reusable slots now live in fixed-size per-chunk bitmaps, with a hot reusable-chunk hint per size class. Sweep no longer writes allocator links into dead cells. Tail trimming counts and removes bitmap state only for discarded chunks.

Implementation: 4e3de6f5
Publication: 24656d74
Pre-existing amplify seed 107 timeout: #103
Pre-existing midgc CI case: #96

Acceptance criteria

  • Reuse freed slots without one intrusive linked-list write per dead cell.
  • Preserve partially live chunks, mixed size classes, stale-header rejection, ownership indexes, exact stats, and bounded tail trimming.
  • Prove wholly empty and fragmented chunk reuse, full/minor collections, OOM recovery, teardown, and parallel allocation/sweep safety.
  • Exact-parent direct and 1/2/4/8-lane shared object-churn A/B retains exact checksums and materially improves the publication load.
  • Pass focused allocator/GC/no-GIL units, full units once, and relevant TSan/threadfuzz gates; deterministic unrelated failures reproduce on the exact parent and are tracked as CI: midgc termination-reaction seed can miss a parallel collection #96/Fuzz: diagnose deterministic amplify seed 107 timeout under TSan #103.
  • Refresh the full report, raw TSV, README, and benchmark guide after a retained change.

Activity

  1. chrisbbreuer commented on Jul 14, 2026

    @chrisbbreuer
    MemberAuthor

    Implementation is now on main as 4e3de6f5 (perf(gc): track reusable slots outside cells (#102)).

    What changed:

    • replaced intrusive freed-cell FreeNode writes with fixed-size per-chunk bitmaps
    • added a hot reusable-chunk hint while keeping exact per-bucket locking
    • made tail trimming count/drop bitmap state only for discarded chunks
    • preserved maintained capacity/issued/live/free/fresh/reused/freed counters
    • added fragmented reuse coverage proving the backing does not write allocator metadata into freed cell payloads

    Exact-parent A/B against untouched e4b72407 (checksums exact):

    • direct object_churn, 100 jobs, 21 samples: 190.549 -> 177.473 ms (7.37% faster)
    • shared 8x10, 21 samples: 511.461 -> 513.864 ms (-0.47%, neutral)
    • publication-load shared 8x100, 6 samples: 8736.301 -> 8485.471 ms (2.96% faster)

    Validation:

    The full 1,540-sample JSC comparison and README/docs refresh are next; keeping this issue open until publication and CI are complete.

  2. chrisbbreuer commented on Jul 14, 2026

    @chrisbbreuer
    MemberAuthor

    Publication and the remaining exact-parent lane sweep are complete.

    Exact-parent shared object_churn A/B at the 100-job publication load (two alternating rounds, six samples per binary/lane, exact checksums):

    • 1 lane: 375.592 -> 371.525 ms (1.09% faster)
    • 2 lanes: 753.025 -> 734.590 ms (2.51% faster)
    • 4 lanes: 2012.021 -> 1765.678 ms (13.95% faster)
    • 8 lanes: 8736.301 -> 8485.471 ms (2.96% faster)

    Published in 24656d74 from measured clean commit 4e3de6f5:

    New full-matrix headline:

    • direct: 9/10 wins; 2.56x geometric-mean throughput lead over JSC
    • warmed 8 lanes: 2.54x lead; scaling 5.18x vs JSC 5.32x
    • cold 8 lanes: 2.58x lead; scaling 5.29x vs JSC 5.25x
    • shared 8-lane geometric-mean scaling: 4.09x
    • object_churn: 176.398 ms direct and 9203.183 ms shared 8-lane

    The full run captured battery power at 93% and discharging, which is disclosed in the report/README. Cross-publication changes include host variation; the interleaved exact-parent A/B above is the causal evidence.

  3. chrisbbreuer commented on Jul 14, 2026

    @chrisbbreuer
    MemberAuthor

    Completed on main in 4e3de6f5 with publication 24656d74. All acceptance criteria are checked above; exact-parent direct and 1/2/4/8 shared A/B retained exact checksums and improved every measured point. Follow-up fuzz/lifecycle failures that reproduce on the parent remain tracked independently in #96 and #103.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions