Unpickling: share one EntityRef per non-local reference row - #20364
Merged
Conversation
`u_tcref` wrapped a fresh `EntityRef` around the shared `NonLocalEntityRef` on every mention. Reading a 489-reference project that is 88642 wrappers around 1919 rows - 46 per row - and they are all equal: an `EntityRef` is the row plus a `binding` cache that resolves deterministically from it, so sharing one per row also means resolving once instead of once per mention. Cached in an array beside the `inlerefs` table, so the key is the row index that is already being read. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SSWUAYfpj82BHvzpkUCy8Z
Contributor
|
T-Gro
approved these changes
Aug 27, 2026
This was referenced Aug 27, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
u_tcrefwrapped a freshEntityRefaround the sharedNonLocalEntityRefon every mention. Reading a489-reference project that is 88642 wrappers around 1919 rows — 46 per row.
They are all equal. An
EntityRefis the row plus abindingfield that caches the resolution, and theresolution is a function of the row, so sharing one wrapper per row also resolves once instead of once per
mention. The cache is an array beside the
inlerefstable, keyed by the row index that is already beingread, so there is no lookup and no hashing.
Correctness
the rest 0).
bindingcache. That is sound because the binding is derived from therow and nothing else: two mentions of the same row must resolve to the same entity or the existing
per-mention resolution would already be inconsistent.
ReaderState, so it never spans two pickled blobs.cell: +0.2% on ReSharper.FSharp and +0.4% on Oxpecker against a +0.6% A/A control.