Skip to content

Build the shape reducer once rather than many times - #1487

Open
jonludlam wants to merge 3 commits into
ocaml:masterfrom
jonludlam:upstream-perf-shape-cache
Open

Build the shape reducer once rather than many times#1487
jonludlam wants to merge 3 commits into
ocaml:masterfrom
jonludlam:upstream-perf-shape-cache

Conversation

@jonludlam

Copy link
Copy Markdown
Member

We can share its caches as a result, which massively reduces allocation.

jonludlam and others added 3 commits September 3, 2026 11:34
lookup_shape instantiated Shape_reduce.Make on every call, discarding
its memo tables each time. The reducer depends only on the resolver's
lookup_impl, so construct it alongside the resolver (new Shape_reducer
module) and carry it in Env.resolver; lookups within a link then share
memoized work. Roughly halves peak link memory on core's worst units,
and resolves more source locations since repeated queries share state.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant