-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
Tracking issue for collections reform part 2 (RFC 509) #19986
Comments
cc @gankro |
TODO:Easy
Moderate
|
Note: I'm about to post a PR that does the deprecation for |
cc @bfops I think you were working on upgrading the entry api? |
I can take care of resize for Vec. |
Yeah I'm working on the entry API. Seems to be coming along! |
I'll start work on these methods for RingBuf:
Did you mean |
Yes, sorry. |
I'm starting the misc stabilization, should be over in a 2-3 days :) |
So, some of the misc stuff is done in #20053, but I didn't touch |
thx :) |
Oh, did you mean |
@pczarn That's a good point. I'm inclined to say "follow your heart"? Definitely not |
#20163 mostly upgrades the entry API for HashMap |
Wait why would you want to impl .next_back for the hashmap iterators? That doesn't make sense. |
ExactSizeIterator is a hack I proposed so that .enumerate() could be used back to front on slices. I'm unhappy to see it infect everything. Why impl that trait, and if we want it in general, isn't it time to untie it from double ended iteration? |
Yeah, that is actually straight from the RFC:
The reason is so we can impl ExactSizeIterator (maybe?) as pczarn says (I suppose because we want |
It's not explicitly deciding anything about ExactSizeIterator |
You are correct. To be completely clear, I just speculated that because the referenced PR is the origin of the next_back/next discussion. Ultimately, beyond deciding on that issue, the RFC doesn't detail exactly what to do with that though, so I defer to the powers that be for what action to actually take here. |
I gave a shot at implementing |
Part of collections reform part 1 and 2, rust-lang#18424 and rust-lang#19986 * shrink_to_fit * swap_back_remove * swap_front_remove * truncate * resize
Implements the `append()` and `split_off()` methods proposed by the collections reform part 2 RFC. RFC: rust-lang/rfcs#509 Tracking issue: #19986
I believe this has all since been implemented, so closing. |
Actually |
Ah good point. |
I've started working on |
@apasel422 OK. Then only |
Hello!
I think, benefits are great. First, it lets us to do very flexible splits and merges with only O(log n) operations. Second, some other interesting and usefull functions need it. Third, as I understand (but i am not totally sure), it lets us to implement the But overhead is notable (4 or 8 bytes for each node, depending on machine word size). I think, it is possible to embed this sizes without memory overhead for 64-bit machines (due to aligning).
2.1) Split with O(log n) operations and then calculate size of the one of the results. 2.2) There is another algorithm which doesn't use the fast algorithm with the same complexity, but (as I understand) with greater constant.
Split using O(log n) operations and then calculate sizes of the trees via 2 alternating iterators, but stop when one of the sizes is counted. Which implementation should I use? |
@apasel422, what do you think? |
@xosmig This isn't my area of expertise, but I'd recommend opening a discussion thread on https://internals.rust-lang.org/ or submitting a pull request for whichever option is easiest and CCing @jooert and @gereeter. You might also want to take a look at #26227. |
@apasel422 The main question is "Is this overhead okay or not?". So, who can decide it? |
First, note that option one can be slightly optimized by only storing composite sized in internal nodes. I'm not a big fan of option one - I expect I don't have strong feelings between options two and three. I think that a variation on option two, where the choice of which side to count is made based on which edge was descended at the root node, would probably be the best. It doesn't have the overhead of option three, but still wont take long if you split near the edges. There is also a fourth option, namely dropping support for constant time calls to |
@gereeter |
@gereeter |
If I didn't make any blunder, I am assured that each Internal node should contain itselfs subtree size. |
There are some average values above. The worst case is: |
RFC 509
The text was updated successfully, but these errors were encountered: