Skip to content

Perf: hoist immutable literal-shape validation out of allocation loops #74

Description

@chrisbbreuer

Parent: #62
Follows: #73 / 1821c8a

The post-#73 profile confirms the generic transition work is gone, but the new safe initializer validates the same immutable root-to-final shape chain and compares its property names on every object allocation. The symbolized sample attributes 237 top-of-stack samples (about 5% of the 5-second capture) to the equality routine used by those repeated checks.

Scope:

  • introduce a reusable prepared inline-literal-shape descriptor
  • validate the complete root-to-final chain, slot/count sequence, distinct non-index names, and inline capacity once when preparing the descriptor
  • keep per-object guards for a fresh empty inline-slot receiver and matching value count
  • publish values with the existing insertion barriers and final shape
  • prepare the descriptor only after the quick loop resolves its warmed immutable transitions
  • retain ordinary bytecode fallback and leave synchronized/no-GIL execution unchanged

Acceptance:

  • direct tests prove valid preparation/publication and rejection of indexed, duplicate, wrong-root, wrong-count, occupied, accessor/attribute/key-order, and non-extensible cases
  • VM optimized/ordinary exact result and step coverage stays green
  • post-change profile removes repeated name equality from the allocation hot path
  • pinned 1821c8a A/B is repeatably faster with exact checksums
  • run the full unit plus benchmark-harness suite once only after a measured win
  • commit references this issue and is pushed as Chris without coauthors

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