-
Notifications
You must be signed in to change notification settings - Fork 13k
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
BTreeSet and BTreeMap append optimization #34666
Comments
CC @gereeter |
Am I missing something? I don't see append() on BTreeSet |
@alfiedotwtf what's wrong with this one? |
Gah! I don't know how I managed to land on old documentation: https://doc.rust-lang.org/1.6.0/std/collections/struct.BTreeSet.html Thanks @xosmig :) |
I would love to see this fixed! I have recently developed a data structure [1], which is supposed to be faster than BTreeSet for a specific usage pattern, but I can't write a fair benchmark until BTreeSet supports a [1] https://users.rust-lang.org/t/announcing-teardowntree/8259 |
I think perhaps the current I ran into this problem today, where for a relatively large computational problem, in which I called There are two problems here, as I see it:
Of course, ideally |
cc @ssomers (due to their many improvements to BTreeMap/BTreeSet in the last couple of years) |
Rest assured, I was subscribed... It's not hard to imrpove this in many cases, as Andlon proved, but hard to prove it doesn't become worse in some other situations. A lot of benchmarking to do. |
I was bitten by this in the context of purposefully trying to merge a smaller Footnotes
|
The implementation of `BTreeMap::append` is non-performant making merging changesets very slow. We use `Extend::extend` instead. Refer to: rust-lang/rust#34666 (comment)
The implementation of `BTreeMap::append` is non-performant making merging changesets very slow. We use `Extend::extend` instead. Refer to: rust-lang/rust#34666 (comment)
The implementation of `BTreeMap::append` is non-performant making merging changesets very slow. We use `Extend::extend` instead. Refer to: rust-lang/rust#34666 (comment)
The implementation of `BTreeMap::append` is non-performant making merging changesets very slow. We use `Extend::extend` instead. Refer to: rust-lang/rust#34666 (comment)
The implementation of `BTreeMap::append` is non-performant making merging changesets very slow. We use `Extend::extend` instead. Refer to: rust-lang/rust#34666 (comment)
The implementation of `BTreeMap::append` is non-performant making merging changesets very slow. We use `Extend::extend` instead. Refer to: rust-lang/rust#34666 (comment)
The implementation of `BTreeMap::append` is non-performant making merging changesets very slow. We use `Extend::extend` instead. Refer to: rust-lang/rust#34666 (comment)
The implementation of `BTreeMap::append` is non-performant making merging changesets very slow. We use `Extend::extend` instead. Refer to: rust-lang/rust#34666 (comment)
The implementation of `BTreeMap::append` is non-performant making merging changesets very slow. We use `Extend::extend` instead. Refer to: rust-lang/rust#34666 (comment)
The implementation of `BTreeMap::append` is non-performant making merging changesets very slow. We use `Extend::extend` instead. Refer to: rust-lang/rust#34666 (comment)
The implementation of `BTreeMap::append` is non-performant making merging changesets very slow. We use `Extend::extend` instead. Refer to: rust-lang/rust#34666 (comment)
The implementation of `BTreeMap::append` is non-performant making merging changesets very slow. We use `Extend::extend` instead. Refer to: rust-lang/rust#34666 (comment)
The implementation of `BTreeMap::append` is non-performant making merging changesets very slow. We use `Extend::extend` instead. Refer to: rust-lang/rust#34666 (comment)
When the largest key of one tree is less than the smallest key of another tree, there is a way to merge trees using only O(log n) operations.
Maybe logarithmic
merge
should be a separate method.I'm ready to work on it.
UPD:
Also sometimes it may be better to push elements of one tree to another one with O(min_length log(max_length)) operations instead of rebuild with O(n + m) operations (like in #32526).
But the problem is that it's hard to determine which approach is better in a particular case.
The text was updated successfully, but these errors were encountered: