Skip to content

improve worst-case performance of BTreeSet intersection v2 - #59078

Closed
ssomers wants to merge 1 commit into
rust-lang:masterfrom
ssomers:btreeset_intersection_revisited
Closed

improve worst-case performance of BTreeSet intersection v2#59078
ssomers wants to merge 1 commit into
rust-lang:masterfrom
ssomers:btreeset_intersection_revisited

Conversation

@ssomers

Copy link
Copy Markdown
Contributor

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
Copy Markdown
Contributor

r? @joshtriplett

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

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

Copy link
Copy Markdown
Contributor

r? @scottmcm

@Mark-Simulacrum

Copy link
Copy Markdown
Member

@bors try

@bors

bors commented Mar 13, 2019

Copy link
Copy Markdown
Collaborator

⌛ 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

bors commented Mar 13, 2019

Copy link
Copy Markdown
Collaborator

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

@scottmcm

Copy link
Copy Markdown
Member

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

@ssomers

ssomers commented Mar 13, 2019

Copy link
Copy Markdown
ContributorAuthor

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.

@ssomersssomers changed the title improve worst-case performance of BTreeSet intersectionimprove worst-case performance of BTreeSet intersection v2Mar 14, 2019
@ssomersssomers 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
@scottmcmscottmcm 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 freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-authorStatus: 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

@ssomers@rust-highfive@Centril@Mark-Simulacrum@bors@scottmcm@joshtriplett