-
Notifications
You must be signed in to change notification settings - Fork 16
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
Keep track of number of set elements in map #33
Conversation
This allows much more efficient versions of len() and is_empty(), and also enables ExactSizeIterator to be implemented for VecMap's iterators. Fixes contain-rs#32
Could you add some more test cases to make sure all your changes are right? One thing off the top of my head: read some elements from the iterators and check that size_hint updates accordingly. |
Oh wow, haha great! That's what I get for reviewing while falling asleep! Lemme just double check with some people before hitting merge. |
hey @kbknapp you (clap-rs) seem to be the biggest user of VecMap; any thoughts on whether this would improve your use case, or just add overhead? |
@gankro I recently switched to a bare I have some worst case scenarios where Of course keeping in mind in the grand scheme of things, this is probably a very, very small portion of the total execution time. That's kind of a non-answer of, "This change doesn't affect my use case right now at all." with the caveat of I'd like to see some benches for potential future use 😜 |
To me, this was mostly about the large (and potentially unexpected) slowdown for @kbknapp what kind of benchmark results is it you'd like to see? In particular, what's the workload you have in mind where this would arise (closed-loop add/remove from the map?) |
Let's keep this alive. |
Let's just go ahead with this. Should be trivial overhead....... |
Nice! @gankro can you also do a (minor?) version bump? |
0.8.0 published |
This allows much more efficient versions of
len()
andis_empty()
, and also enablesExactSizeIterator
to be implemented forVecMap's
iterators.Fixes #32