Skip to content

Perf: right-size the object-only GC slab class #79

Description

@chrisbbreuer

Parent: #62
Follow-up to rejected #78.

Evidence

Compile-time Heap.cellAllocationBytes values on current main:

  • object: 656 bytes (624-byte payload + 32-byte header)
  • function: 288 bytes
  • generator: 264 bytes
  • environment: 248 bytes
  • promise: 192 bytes
  • iterator helper / module namespace: 112 bytes
  • bound function: 64 bytes

The current slab classes are 64, 128, 256, 512, 1024, 2048, so ordinary objects alone cross the 512-byte boundary and consume a 1024-byte slot: 368 bytes / 35.9% internal waste per object. #78 added a 768-byte seventh class and regressed object_churn about 9.8%, consistent with adding another linear classification/ownership bucket to every hot path.

Proposed slice

  • replace the existing 1024-byte class with an exact 656-byte object class instead of adding a bucket;
  • keep the bucket count and classification depth unchanged;
  • retain the large-chunk policy for the 656-byte object class;
  • derive the regression test from Heap.cellAllocationBytes(Object) so layout drift fails visibly;
  • update allocator docs that name the large object classes;
  • preserve fallback/delegation, ownership indexes, free-list reuse, trimming, bulk teardown, heap caps, and parallel locking.

Acceptance

  • compile-time proof still shows every managed cell maps to owned slab storage;
  • focused GC backing/nursery tests pass with zero leaks;
  • GC profile confirms ordinary cells use the 656-byte class with fewer/equal chunks and correct live/free accounting;
  • seven alternating current-main/candidate process pairs preserve the exact object_churn checksum and show a meaningful median win;
  • only then run the batched full suite/harness and land a small conventional commit.

Activity

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