Skip to content

Ten parallel closure registries cost 11.8 MB for ~59k functions — one packed record instead of ten maps keyed by the same pointer #9707

Description

@proggeramlug

From the validated heap census of cc. side_tables.closure_registries = 11.8 MB across ~59,000 functions (~200 B per function), spread over ten separate maps all keyed by the same closure pointer.

Ten hash maps each storing the same key set means ten key copies, ten allocations, ten sets of bucket overhead, and ten lookups on any path that needs more than one attribute — a cost paid in both memory and time. One record per function with ten fields (or a struct-of-arrays indexed by a dense function id) removes the duplication outright.

Ceiling: ~9 MB recovered, plus faster multi-attribute lookups.

Related structural note from the same census: fn name/source registries add another 5.2 MB (the name registry alone holds 72,713 entries, added by #9521 for stack traces). If a dense function-id scheme lands here, those should ride on it rather than keep their own keying.

Verification

PERRY_GC_CENSUS=<path> reports each registry separately, so before/after is direct. Keep the stack-frame naming (#9521) and fn.name fixtures green — the registries are what make those work.

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