Repository navigation
Conversation
container.rs, append_container.rs and typearena.rs each defined the same hash_of_type function, with its own HasherForTypeId, and their own 32-bucket constant. Move both into a type_bucket module, so how a type picks its bucket is written once. Each caller hashes the same type as before, so every type stays in the same bucket. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #67 +/- ##
==========================================
- Coverage 80.17% 79.51% -0.67%
==========================================
Files 10 11 +1
Lines 2068 1884 -184
==========================================
- Hits 1658 1498 -160
+ Misses 410 386 -24 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
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.
Summary
container.rs(used byIntern),append_container.rs(Intern32) andtypearena.rs(NewIntern) each contained an identical ~35-linehash_of_typefunction with its ownHasherForTypeId, plus their own32constant for the number of buckets. This moves both into a newsrc/type_bucket.rs:TYPE_BUCKETS: the number of buckets (32), now defined once;type_bucket::<T>(): which bucket holdsT's container (the old hash, taken moduloTYPE_BUCKETS).The callers shrink to
self.containers[type_bucket::<T>()]. Net: −132/+23 lines in the existing files, plus the new 50-line module (including a small test).Behaviour
Unchanged. The hasher and the arithmetic are the same, and each caller hashes the same type as before. In particular
typearena.rshashedMutex<HashSet<T>>rather thanT, and still does (type_bucket::<Mutex<HashSet<T>>>()), so every type lands in the same bucket.Test plan
cargo test --all-features -- --test-threads=1andcargo testcargo checkwith default features,--features _experimental-new-intern,--features arc,tinyset,--no-default-features --features arc,--all-features; no new warnings or errors (the existing ones, e.g.--features intern32withoutdeepsize, are fixed separately in Move the benchmarks to scaling 0.9, and compare with the previous release #66)cargo +1.71.0 check --all-featuresIndependent of #66; based on master.
🤖 Generated with Claude Code