-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Sort MonoItems by span instead of DefIndex. #92323
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
Conversation
r? @estebank (rust-highfive has picked a reviewer for you, use r? to override) |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Thanks for fixing this, @cjgillot! :) |
@bors try @rust-timer queue |
Awaiting bors try build completion. @rustbot label: +S-waiting-on-perf |
⌛ Trying commit ae6ce468dd80df306640a56eebc4d170b804b259 with merge ad15d5d984b71fc84a26a3c31579c7cc4b0e1ac9... |
☀️ Try build successful - checks-actions |
Queued ad15d5d984b71fc84a26a3c31579c7cc4b0e1ac9 with parent 26c06cf, future comparison URL. |
Finished benchmarking commit (ad15d5d984b71fc84a26a3c31579c7cc4b0e1ac9): comparison url. Summary: This change led to large relevant mixed results 🤷 in compiler performance.
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 led to changes in compiler perf. Next Steps: If you can justify the regressions found in this try perf run, please indicate this with @bors rollup=never |
// the codegen tests and can even make item order | ||
// unstable. | ||
InstanceDef::Item(def) => { | ||
def.did.as_local().map(|def_id| tcx.def_span(def_id)) |
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.
Maybe extract a single BytePos
? It would reduce the number of conversions from Span
to SpanData
, which could be perf significant with incremental relative spans.
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.
OK, so it looks like we also need to include SyntaxContext
to obtain "natural" order.
In that case, one thing I don't understand, what allows us to rely onSyntaxContext
order? Doesn't it suffer from the similar issue as DefIndex
given that we remap IDs when loading them from on disk cache, and then sort based on their values?
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.
Marking as blocked until we reach a strategy for SyntaxContext
. Each additional use of its PartialOrd
impl will make it even harder to remove.
ef3e932
to
08c8028
Compare
@bors try @rust-timer queue |
Awaiting bors try build completion. @rustbot label: +S-waiting-on-perf |
⌛ Trying commit 08c8028afda89f06cd4fae1ae7469a10db005094 with merge 1b73506c363c317e60a0d8c2196dd03b8372cdec... |
☀️ Try build successful - checks-actions |
Queued 1b73506c363c317e60a0d8c2196dd03b8372cdec with parent 7be8693, future comparison URL. |
Finished benchmarking commit (1b73506c363c317e60a0d8c2196dd03b8372cdec): comparison url. Summary: This change led to large relevant mixed results 🤷 in compiler performance.
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 led to changes in compiler perf. Next Steps: If you can justify the regressions found in this try perf run, please indicate this with @bors rollup=never |
☔ The latest upstream changes (presumably #95656) made this pull request unmergeable. Please resolve the merge conflicts. |
@bors try @rust-timer queue |
Awaiting bors try build completion. @rustbot label: +S-waiting-on-perf |
⌛ Trying commit e64ba94 with merge 915673e44f6d86547c2ba2e330e57a5d0060b87f... |
☀️ Try build successful - checks-actions |
Queued 915673e44f6d86547c2ba2e330e57a5d0060b87f with parent 44bd81d, future comparison URL. |
Finished benchmarking commit (915673e44f6d86547c2ba2e330e57a5d0060b87f): comparison url. Instruction count
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 |
The codegen tests rely on items being process in the same order as they appear in the file.
Instead of sorting them by
DefIndex
, we should just sort them bydef_span
.cc #90317.