-
Notifications
You must be signed in to change notification settings - Fork 288
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Prepare hashbrown for inclusion in the standard library #46
Conversation
Ok here's my notes from doing a fairly quick skim over map.rs (since it's a pretty trivial file now): general style nit: it's a bit more clear (and reads less goofy) to write general style nit: in case you missed it, you can now write general style nit: it's possible also performance concern on performance concern on VacantEntry: Oh Wait This Has The Same Issue? Literally the core motivation of this API is avoiding this kind of double-lookup. I suppose the argument is that lookup is so fast that redoing it on insert is fine, in conjunction with the fact find/insert want fundamentally different matching algorithms..? performance/correctness concern on RawVacantEntryMut::insert: I don't think you're supposed to rehash the key here. I believe the intended contract of the API is that we trust you to pass a key with a matching hash (which we already computed to get here). |
Regarding the concerns about double-lookup, this is by design. SInce SwissTable uses tombstones, the first empty bucket that you find is not necessarily the one you will insert into: you could reuse a tombstone. This is why normal lookups use Note that |
That makes sense. And also explains why you wouldn't want to at least cache which group you stopped on to resume insertion (you could have walked over an massive graveyard of DELETED to find an empty slot). |
Regarding |
hrm, this seems like a really whack API design, since one of the biggest motivations was "lookup with &K -> insert K", which this pair of methods is specifically making awkward to do optimally. But if what the libs folks settled on... shrug |
Since the new Cargo.toml requires rename-dependencies which is only available in 1.31, I went ahead and converted the entire crate to 2018 edition. This is technically a breaking change since the minimum Rust version is bumped from 1.29 to 1.31. |
Also adds PhantomData<T> to RawTable and RawIntoIter
bors r+ |
46: Prepare hashbrown for inclusion in the standard library r=Amanieu a=Amanieu See rust-lang/rust#58623. Co-authored-by: Amanieu d'Antras <amanieu@gmail.com>
Build failed
|
bors retry |
46: Prepare hashbrown for inclusion in the standard library r=Amanieu a=Amanieu See rust-lang/rust#58623. Co-authored-by: Amanieu d'Antras <amanieu@gmail.com>
Build succeeded
|
See rust-lang/rust#58623.