Skip to content

[1/n] use u32 for item indexes#242

Merged
sunshowers merged 2 commits intomainfrom
sunshowers/spr/1n-use-u32-for-item-indexes
May 4, 2026
Merged

[1/n] use u32 for item indexes#242
sunshowers merged 2 commits intomainfrom
sunshowers/spr/1n-use-u32-for-item-indexes

Conversation

@sunshowers
Copy link
Copy Markdown
Collaborator

Preparation for upcoming work to switch to a slab implementation. u32 is quite nice for cache density in practice, and most benchmarks get better. A few become worse due to FxHasher being slightly better with 64-bit integers, though regressions completely vanish with the next commit in the series since we remove FxHasher.

This does put a 2^32 - 1 (we reserve one value as the sentinel) limit on the number of items in the set, but that's a completely reasonable limit to have. We'll want to document this in the changelog, though.

Also use a newtype internally to ensure we aren't getting anything wrong.

Created using spr 1.3.6-beta.1
Created using spr 1.3.6-beta.1
@sunshowers sunshowers merged commit 337cd25 into main May 4, 2026
34 checks passed
@sunshowers sunshowers deleted the sunshowers/spr/1n-use-u32-for-item-indexes branch May 4, 2026 19:47
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