Skip to content

Remove dead cache from IndexSet#262

Open
fitzgen wants to merge 1 commit into
bytecodealliance:mainfrom
fitzgen:remove-unused-cache
Open

Remove dead cache from IndexSet#262
fitzgen wants to merge 1 commit into
bytecodealliance:mainfrom
fitzgen:remove-unused-cache

Conversation

@fitzgen

@fitzgen fitzgen commented Jul 6, 2026

Copy link
Copy Markdown
Member

The IndexSet::cache field was never populated with a real value, and cache.set() was only ever called with the (INVALID, 0) sentinel, so the fast-path in maybe_elem() was unreachable and the invalidation stores in elem() and maybe_elem_mut() were pure-overhead on every set/get/union_with. Removing it additionally shrinks IndexSet by 16 bytes.

The `IndexSet::cache` field was never populated with a real value, and
`cache.set()` was only ever called with the `(INVALID, 0)` sentinel, so the
fast-path in `maybe_elem()` was unreachable and the invalidation stores in
`elem()` and `maybe_elem_mut()` were pure-overhead on every
`set`/`get`/`union_with`. Removing it additionally shrinks `IndexSet` by 16
bytes.
@fitzgen fitzgen requested a review from cfallin July 6, 2026 14:46
@fitzgen

fitzgen commented Jul 6, 2026

Copy link
Copy Markdown
Member Author

(FWIW, I also experimented with fixing the cache so that it would actually get populated, but it wasn't a speed up on Sightglass.)

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