PEGO

A250: Typed Object Slabs

After small-result bootstrap allocations, typed struct and terminal cells use chunks to amortize per-object allocation.

Mechanism and Invariants

Each typed owner starts slabs at 8 cells and grows to 256. Fresh owner state avoids reusing returned cells; one escaped cell can retain unused siblings in its chunk. Bootstrap and optional liveness cleanup are separate policies. Direct construction and Node conversion use the same object allocator.

Scope and State

Default generated Go typed output only. Node slabs, engine values and TypeScript objects use different allocation policies.

Reference Control

Private disableTypedObjectSlabs emits individual object allocation while holding list slab policy independently selectable. It is not the bootstrap-disable control.

Evidence and Implementation

Records 048/074 describe typed construction and smaller first chunks; 098 adds independent early allocations. Retained-output controls preserve spans, sharing and field pointers. Slab allocation can reduce object counts while increasing retained siblings; current broad speedup is not established by the individual allocator controls.

Evidence records: 048, 074, 098.

Source owners: astNew generation, disableTypedObjectSlabs, objects/individual controls.

The comparison policy distinguishes same-source controls, historical changes and full checkpoints.

Related mechanisms: A070, A260, A090.

Optimization Catalog