Skip to content

Remove dead cache from IndexSet#262

Merged
cfallin merged 1 commit into
bytecodealliance:mainfrom
fitzgen:remove-unused-cache
Jul 20, 2026
Merged

Remove dead cache from IndexSet#262
cfallin merged 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.)

@cfallin cfallin left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, the actual cache usage was removed a while ago -- thanks for catching this!

@cfallin
cfallin merged commit bbc3f96 into bytecodealliance:main Jul 20, 2026
6 checks passed
@fitzgen
fitzgen deleted the remove-unused-cache branch July 20, 2026 19:22
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.

2 participants