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

Remove token::Lit from ast::Lit. #101528

Closed

Conversation

nnethercote
Copy link
Contributor

token::Lit contains a kind field that indicates what kind of literal it is. ast::Lit currently wraps a token::Lit but also has its own kind field. Which means that ast::Lit encodes the literal kind in two different ways.

This commit changes ast::Lit so it no longer wraps token::Lit. It now contains the symbol and suffix fields from token::Lit, but not the kind field, eliminating the redundancy. This requires extending ast::LitKind::ByteStr to include a StrStyle to properly distinguish between cooked and raw byte string literals at the ast::Lit level.

r? @petrochenkov

`token::Lit` contains a `kind` field that indicates what kind of literal
it is. `ast::Lit` currently wraps a `token::Lit` but also has its own
`kind` field. Which means that `ast::Lit` encodes the literal kind in
two different ways.

This commit changes `ast::Lit` so it no longer wraps `token::Lit`. It
now contains the `symbol` and `suffix` fields from `token::Lit`, but not
the `kind` field, eliminating the redundancy. This requires extending
`ast::LitKind::ByteStr` to include a `StrStyle` to properly distinguish
between cooked and raw byte string literals at the `ast::Lit` level.
@rustbot rustbot added the T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. label Sep 7, 2022
@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Sep 7, 2022
@rustbot
Copy link
Collaborator

rustbot commented Sep 7, 2022

Some changes occurred in src/tools/clippy

cc @rust-lang/clippy

Some changes occurred in src/tools/rustfmt

cc @rust-lang/rustfmt

@nnethercote
Copy link
Contributor Author

I'm not expecting much performance effect, but let's check anyway:

@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 7, 2022
@bors
Copy link
Contributor

bors commented Sep 7, 2022

⌛ Trying commit c16f710 with merge 1c91510426b7b23caa649d60e0f31de9e5b09678...

@bors
Copy link
Contributor

bors commented Sep 7, 2022

☀️ Try build successful - checks-actions
Build commit: 1c91510426b7b23caa649d60e0f31de9e5b09678 (1c91510426b7b23caa649d60e0f31de9e5b09678)

@rust-timer
Copy link
Collaborator

Queued 1c91510426b7b23caa649d60e0f31de9e5b09678 with parent 0568b0a, future comparison URL.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (1c91510426b7b23caa649d60e0f31de9e5b09678): comparison URL.

Overall result: ❌✅ regressions and improvements - 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
Regressions ❌
(secondary)
2.0% [2.0%, 2.0%] 1
Improvements ✅
(primary)
-0.8% [-1.0%, -0.7%] 6
Improvements ✅
(secondary)
-1.9% [-1.9%, -1.9%] 1
All ❌✅ (primary) -0.8% [-1.0%, -0.7%] 6

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)
- - 0
Regressions ❌
(secondary)
2.1% [2.1%, 2.1%] 1
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) - - 0

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)
2.2% [2.2%, 2.2%] 1
Regressions ❌
(secondary)
3.4% [2.5%, 4.8%] 3
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-3.4% [-3.4%, -3.4%] 1
All ❌✅ (primary) 2.2% [2.2%, 2.2%] 1

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 8, 2022
@nnethercote
Copy link
Contributor Author

The html5ever improvements are probably noise, which means this is performance-neutral.

@rustbot label: +perf-regression-triaged

@rustbot rustbot added the perf-regression-triaged The performance regression has been triaged. label Sep 8, 2022
@nnethercote
Copy link
Contributor Author

I have moved this into #101562, where it's one of several changes required to shrink ast::Expr.

@nnethercote nnethercote closed this Sep 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
perf-regression Performance regression. perf-regression-triaged The performance regression has been triaged. 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.

6 participants