-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
optimize superset
method of IntervalSet
#97862
Conversation
r? @lcnr (rust-highfive has picked a reviewer for you, use r? to override) |
impl looks good While you're at it, can you document the invariants of I would like to have that documented, or even better, I would like a method @bors try @rust-timer queue |
Awaiting bors try build completion. @rustbot label: +S-waiting-on-perf |
⌛ Trying commit 8db6d4b with merge b0e738d5614446ebae0880e368e25c36c57f258c... |
☀️ Try build successful - checks-actions |
Queued b0e738d5614446ebae0880e368e25c36c57f258c with parent 47aee31, future comparison URL. |
Finished benchmarking commit (b0e738d5614446ebae0880e368e25c36c57f258c): comparison url. Instruction countThis benchmark run did not return any relevant results for this metric. Max RSS (memory usage)Results
CyclesResults
If you disagree with this performance assessment, please file an issue in rust-lang/rustc-perf. Benchmarking this pull request likely means that it is perf-sensitive, so we're automatically marking it as not fit for rolling up. While you can manually mark this PR as fit for rollup, we strongly recommend not doing so since this PR may lead to changes in compiler perf. @bors rollup=never Footnotes |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Thanks for reviewing! I added the |
nice to see that checking the invariants actually found a bug 😆 even if that bug probably doesn't result in bad behavior as it only affects empty domains. @bors r+ |
📌 Commit 65a5b08 has been approved by |
This comment has been minimized.
This comment has been minimized.
} | ||
current = Some(*end); | ||
} | ||
current.map_or(true, |x| x < self.domain as u32) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it seems like that invariant isn't actually assumed rn? 🤔 generally, the domain
seems mostly irrelevant, could "just" use u32::MAX
instead for the range end.
🤷 don't really care how you deal with the test failure
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we'd better make sure all intervals don't exceed domain
, after all, both insert_all
and insert_range
use domain as the range maximum. I increased the domain
in the test from 3000 to 10000, which I think should be reasonable
@bors r+ |
📌 Commit 726b35b has been approved by |
☀️ Test successful - checks-actions |
Finished benchmarking commit (6dc598a): comparison url. Instruction countThis benchmark run did not return any relevant results for this metric. Max RSS (memory usage)Results
CyclesResults
If you disagree with this performance assessment, please file an issue in rust-lang/rustc-perf. @rustbot label: -perf-regression Footnotes |
Given that intervals in the
IntervalSet
are sorted and strictly separated( it means theend
of the previous interval will not be equal to thestart
of the next interval), we can reduce the complexity of thesuperset
method from O(NMlogN) to O(2N) (N is the number of intervals and M is the length of each interval)