Skip to content
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

improve worst-case performance of BTreeSet intersection v2 #59078

Closed

Conversation

ssomers
Copy link
Contributor

@ssomers ssomers commented Mar 10, 2019

Alternative to pull request #58577: back out of attempts to optimize using ranges, more elegant code (I think).

The stable public type Intersection changes from struct to enum. If that matters, then perhaps changing the fields like in the other proposal also mattered.

@rust-highfive
Copy link
Collaborator

r? @joshtriplett

(rust_highfive has picked a reviewer for you, use r? to override)

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Mar 10, 2019
@Centril
Copy link
Contributor

Centril commented Mar 11, 2019

r? @scottmcm

@Mark-Simulacrum
Copy link
Member

@bors try

@bors
Copy link
Contributor

bors commented Mar 13, 2019

⌛ Trying commit a379504 with merge b75f65a...

bors added a commit that referenced this pull request Mar 13, 2019
improve worst-case performance of BTreeSet intersection

Alternative to [pull request #58577](#58577): back out of attempts to optimize using ranges, more elegant code (I think).

The stable public type Intersection changes from struct to enum. If that matters, then perhaps changing the fields like in the other proposal also mattered.
@bors
Copy link
Contributor

bors commented Mar 13, 2019

☀️ Try build successful - checks-travis
Build commit: b75f65a

@scottmcm
Copy link
Member

It looks like @KodrAus signed off on the other PR? What's the status of this, given that?

@ssomers
Copy link
Contributor Author

ssomers commented Mar 13, 2019

I have no clue. I don't think any of it was actually merged. I guess tweaking it over and over wasn't the intention but I'm learning. And right now, I think this PR is a better version of the best parts of the first one. It doesn't go as far, but I'm not sure it makes sense to optimize for some cases at some cost for the situations where the previous implementation was best: intersection of small sets. In the "real world" case I'm using this for (through https://github.com/ssomers/Bron-Kerbosch/blob/master/rust/bron_kerbosch/src/util.rs), the further optimization in the other PR doesn't make a difference.

PS better except for the issue that perhaps Intersection being an enum exposes implementation detail.
PPS I found a relevant stackoverflow question and the only answer is basically the way it's done in the other PR (separate struct) but then the author advises against it.
PPPS There are unstable pub enums in the rust code, but I didn't find stable pub enums with unstable variants. And I did find an example of a private enum wrapped by a pub struct: std::ascii::EscapeDefault.

@ssomers ssomers changed the title improve worst-case performance of BTreeSet intersection improve worst-case performance of BTreeSet intersection v2 Mar 14, 2019
@ssomers ssomers closed this Mar 21, 2019
Centril added a commit to Centril/rust that referenced this pull request Apr 2, 2019
…ited_again, r=KodrAus

improve worst-case performance of BTreeSet intersection v3

Variation of [rust-lang#59078](rust-lang#59078) with `Intersection` remaining a struct

r? @scottmcm
Centril added a commit to Centril/rust that referenced this pull request Apr 3, 2019
…ited_again, r=KodrAus

improve worst-case performance of BTreeSet intersection v3

Variation of [rust-lang#59078](rust-lang#59078) with `Intersection` remaining a struct

r? @scottmcm
@ssomers ssomers deleted the btreeset_intersection_revisited branch April 6, 2019 08:14
@scottmcm scottmcm added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Aug 6, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants