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

Tell rustc about unused bits in Span. #102035

Closed
wants to merge 1 commit into from

Conversation

nnethercote
Copy link
Contributor

This shrinks the size of Option<Span> and similar types, which shrinks several AST and HIR nodes. The most important of these are hir::Expr and ast::Ty.

This change was first attempted in #93747 where it had little effect. But the improved niche-filling implemented by #94075 means this change now has a much bigger effect.

r? @cjgillot

@rustbot rustbot added the T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. label Sep 20, 2022
@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Sep 20, 2022
@nnethercote
Copy link
Contributor Author

@bors try @rust-timer queue

@rust-timer
Copy link
Collaborator

Awaiting bors try build completion.

@rustbot label: +S-waiting-on-perf

@rustbot rustbot added the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Sep 20, 2022
@bors
Copy link
Contributor

bors commented Sep 20, 2022

⌛ Trying commit 63596860eb24e80b8e7d024d11f983296a262f2c with merge 9b1b504285e7b4440ae811dc71fbffdc7be2ec92...

@bors
Copy link
Contributor

bors commented Sep 20, 2022

☀️ Try build successful - checks-actions
Build commit: 9b1b504285e7b4440ae811dc71fbffdc7be2ec92 (9b1b504285e7b4440ae811dc71fbffdc7be2ec92)

@rust-timer
Copy link
Collaborator

Queued 9b1b504285e7b4440ae811dc71fbffdc7be2ec92 with parent 2019147, future comparison URL.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (9b1b504285e7b4440ae811dc71fbffdc7be2ec92): comparison URL.

Overall result: ❌ regressions - ACTION NEEDED

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.

Next Steps: If you can justify the regressions found in this try perf run, please indicate this with @rustbot label: +perf-regression-triaged along with sufficient written justification. If you cannot justify the regressions please fix the regressions and do another perf run. If the next run shows neutral or positive results, the label will be automatically removed.

@bors rollup=never
@rustbot label: +S-waiting-on-review -S-waiting-on-perf +perf-regression

Instruction count

This is a highly reliable metric that was used to determine the overall result at the top of this comment.

mean1 range count2
Regressions ❌
(primary)
0.4% [0.2%, 1.2%] 103
Regressions ❌
(secondary)
0.6% [0.2%, 1.1%] 66
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-0.6% [-0.6%, -0.6%] 1
All ❌✅ (primary) 0.4% [0.2%, 1.2%] 103

Max RSS (memory usage)

Results

This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.

mean1 range count2
Regressions ❌
(primary)
1.4% [0.7%, 2.7%] 25
Regressions ❌
(secondary)
4.2% [4.2%, 4.2%] 1
Improvements ✅
(primary)
-1.0% [-1.4%, -0.6%] 8
Improvements ✅
(secondary)
-2.4% [-5.0%, -1.0%] 20
All ❌✅ (primary) 0.9% [-1.4%, 2.7%] 33

Cycles

Results

This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.

mean1 range count2
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-4.0% [-4.0%, -4.0%] 1
All ❌✅ (primary) - - 0

Footnotes

  1. the arithmetic mean of the percent change 2 3

  2. number of relevant changes 2 3

@rustbot rustbot added perf-regression Performance regression. and removed S-waiting-on-perf Status: Waiting on a perf run to be completed. labels Sep 20, 2022
@nnethercote
Copy link
Contributor Author

Hmm.

  • instruction counts: lots of 1% or smaller regressions.
  • max-rss: some decent wins for secondary benchmarks that are HIR-heavy, but also some regressions on real-world crates, WTF.
  • cycles and wall-time look neutral, though they are noisy enough that it's hard to tell for sure.

@cjgillot
Copy link
Contributor

I marking this PR as blocked on improvements to niche optimization tracked by #101872

@cjgillot cjgillot added S-blocked Status: Blocked on something else such as an RFC or other implementation work. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Sep 25, 2022
This shrinks the size of `Option<Span>` and similar types, which shrinks
several AST and HIR nodes. The most important of these are `hir::Expr`
and `ast::Ty`.

This change was first attempted in rust-lang#93747 where it had little effect.
But the improved niche-filling implemented by rust-lang#94075 means this change
now has a much bigger effect.

Co-authored-by: Camille Gillot <gillot.camille@gmail.com>
@nnethercote
Copy link
Contributor Author

Let's try a perf run again, just to see what happens.

@bors try @rust-timer queue

@rust-timer
Copy link
Collaborator

Awaiting bors try build completion.

@rustbot label: +S-waiting-on-perf

@rustbot rustbot added the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Oct 17, 2022
@bors
Copy link
Contributor

bors commented Oct 17, 2022

⌛ Trying commit 273fb2a with merge 5445699cee92d57d2c75196ec6b23d56f65dbdca...

@bors
Copy link
Contributor

bors commented Oct 18, 2022

☀️ Try build successful - checks-actions
Build commit: 5445699cee92d57d2c75196ec6b23d56f65dbdca (5445699cee92d57d2c75196ec6b23d56f65dbdca)

@rust-timer
Copy link
Collaborator

Queued 5445699cee92d57d2c75196ec6b23d56f65dbdca with parent 9c2797d, future comparison URL.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (5445699cee92d57d2c75196ec6b23d56f65dbdca): comparison URL.

Overall result: ❌ regressions - ACTION NEEDED

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.

Next Steps: If you can justify the regressions found in this try perf run, please indicate this with @rustbot label: +perf-regression-triaged along with sufficient written justification. If you cannot justify the regressions please fix the regressions and do another perf run. If the next run shows neutral or positive results, the label will be automatically removed.

@bors rollup=never
@rustbot label: +S-waiting-on-review -S-waiting-on-perf +perf-regression

Instruction count

This is a highly reliable metric that was used to determine the overall result at the top of this comment.

mean1 range count2
Regressions ❌
(primary)
0.5% [0.2%, 1.2%] 147
Regressions ❌
(secondary)
0.7% [0.2%, 1.9%] 83
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 0.5% [0.2%, 1.2%] 147

Max RSS (memory usage)

Results

This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.

mean1 range count2
Regressions ❌
(primary)
1.6% [0.7%, 3.0%] 35
Regressions ❌
(secondary)
2.3% [1.6%, 3.5%] 7
Improvements ✅
(primary)
-0.8% [-1.5%, -0.4%] 7
Improvements ✅
(secondary)
-2.8% [-5.1%, -1.1%] 6
All ❌✅ (primary) 1.2% [-1.5%, 3.0%] 42

Cycles

This benchmark run did not return any relevant results for this metric.

Footnotes

  1. the arithmetic mean of the percent change 2

  2. number of relevant changes 2

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-perf Status: Waiting on a perf run to be completed. labels Oct 18, 2022
@apiraino
Copy link
Contributor

visiting and checking progress. according to this comment this is waiting on #101872 which in turn is waiting on an LLVM optimization.

Correct @cjgillot @nnethercote ?

@nnethercote
Copy link
Contributor Author

That's correct.

@nnethercote
Copy link
Contributor Author

@cjgillot: I just tried to update this, but things have changed in Span representation, because of parent fields. Is this change still applicable in a modified form?

@cjgillot
Copy link
Contributor

cjgillot commented Feb 9, 2023

I don't think so. I used those very unused bits to encode the presence of the parent.
I think the current encoding uses all available bits.

@nnethercote
Copy link
Contributor Author

This change no longer works, due to other changes that have happened in the meantime.

@nnethercote nnethercote closed this Feb 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
perf-regression Performance regression. S-blocked Status: Blocked on something else such as an RFC or other implementation work. S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants