Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.
Sign upTracking issue for collections reform part 2 (RFC 509) #19986
Comments
aturon
added
A-libs
B-RFC-approved
labels
Dec 18, 2014
This comment has been minimized.
This comment has been minimized.
|
cc @Gankro |
This comment has been minimized.
This comment has been minimized.
TODO:Easy
Moderate
|
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
Note: I'm about to post a PR that does the deprecation for |
This comment has been minimized.
This comment has been minimized.
|
cc @bfops I think you were working on upgrading the entry api? |
This comment has been minimized.
This comment has been minimized.
|
I can take care of resize for Vec. |
This comment has been minimized.
This comment has been minimized.
|
Yeah I'm working on the entry API. Seems to be coming along! |
This comment has been minimized.
This comment has been minimized.
|
I'll start work on these methods for RingBuf:
Did you mean |
This comment has been minimized.
This comment has been minimized.
|
Yes, sorry. |
This comment has been minimized.
This comment has been minimized.
|
I'm starting the misc stabilization, should be over in a 2-3 days :) |
This comment has been minimized.
This comment has been minimized.
|
So, some of the misc stuff is done in #20053, but I didn't touch |
This comment has been minimized.
This comment has been minimized.
|
thx :) |
This comment has been minimized.
This comment has been minimized.
|
Oh, did you mean |
This comment has been minimized.
This comment has been minimized.
|
@pczarn That's a good point. I'm inclined to say "follow your heart"? Definitely not |
This comment has been minimized.
This comment has been minimized.
|
#20163 mostly upgrades the entry API for HashMap |
This comment has been minimized.
This comment has been minimized.
|
Wait why would you want to impl .next_back for the hashmap iterators? That doesn't make sense. |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
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? |
This comment has been minimized.
This comment has been minimized.
|
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 |
This comment has been minimized.
This comment has been minimized.
|
It's not explicitly deciding anything about ExactSizeIterator |
This comment has been minimized.
This comment has been minimized.
|
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. |
TimDumol
referenced this issue
Jan 1, 2015
Merged
Add append() and split_off() to DList as per coll. reform. #20406
This comment has been minimized.
This comment has been minimized.
|
I gave a shot at implementing |
bors
added a commit
that referenced
this issue
Jan 5, 2015
alexcrichton
added a commit
to alexcrichton/rust
that referenced
this issue
Jan 6, 2015
bors
added a commit
that referenced
this issue
Jan 11, 2015
jooert
referenced this issue
Apr 29, 2015
Merged
Implement `append` and `split_off` for BitSet (RFC 509) #24934
bors
added a commit
that referenced
this issue
May 6, 2015
bors
added a commit
that referenced
this issue
May 7, 2015
bors
added a commit
that referenced
this issue
May 10, 2015
bors
added a commit
that referenced
this issue
May 10, 2015
bors
added a commit
that referenced
this issue
May 10, 2015
bors
added a commit
that referenced
this issue
May 11, 2015
alexcrichton
added
the
T-libs
label
Aug 11, 2015
apasel422
added
the
A-collections
label
Feb 6, 2016
This comment has been minimized.
This comment has been minimized.
|
I believe this has all since been implemented, so closing. |
alexcrichton
closed this
Feb 18, 2016
This comment has been minimized.
This comment has been minimized.
|
Actually |
This comment has been minimized.
This comment has been minimized.
|
Ah good point. |
alexcrichton
reopened this
Feb 18, 2016
This comment has been minimized.
This comment has been minimized.
|
I've started working on |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
@apasel422 OK. Then only |
This comment has been minimized.
This comment has been minimized.
|
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? |
This comment has been minimized.
This comment has been minimized.
|
@apasel422, what do you think? |
This comment has been minimized.
This comment has been minimized.
|
@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. |
This comment has been minimized.
This comment has been minimized.
|
@apasel422 The main question is "Is this overhead okay or not?". So, who can decide it? |
This comment has been minimized.
This comment has been minimized.
|
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 |
This comment has been minimized.
This comment has been minimized.
|
@gereeter |
This comment has been minimized.
This comment has been minimized.
|
@gereeter |
This comment has been minimized.
This comment has been minimized.
|
If I didn't make any blunder, I am assured that each Internal node should contain itselfs subtree size. |
This comment has been minimized.
This comment has been minimized.
|
There are some average values above. The worst case is: |
aturon commentedDec 18, 2014
RFC 509