perf(semantic): use swap_remove instead of into_iter().next() in into_root#17183
Conversation
How to use the Graphite Merge QueueAdd either label to this PR to merge it via the merge queue:
You must have a Graphite account in order to use the merge queue. Sign up using this link. An organization admin has enabled the Graphite Merge Queue in this repository. Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue. This stack of pull requests is managed by Graphite. Learn more about stacking. |
CodSpeed Performance ReportMerging #17183 will not alter performanceComparing Summary
Footnotes
|
|
This is only called 1x so probably no meaningful perf difference |
|
I'm very surprised this is any more performant. Creating a slice iterator is extremely cheap (like 1 operation), and in this case even that 1 op should be removed due to the unchecked assertion.
What makes you think this is faster? Do you have a demonstration that it is? Maybe something has changed with the effectiveness of unchecked assertions. If so it'd be good to find out! |
I fear something has changed in more recent rust versions, because that's not the behaviour I see: https://godbolt.org/z/zrs81Gbns using swap_remove is ~57 lines of assembluy (no panic calls), whereas the previous is ~141 and a panic call. For the iterator case, the assert_unchecked assertion doesn't seem to do anything |
Merge activity
|
18ed7de to
315c9ed
Compare
ff2620d to
605a290
Compare

No description provided.