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

parse_tt: a few more tweaks #95794

Merged
merged 3 commits into from
Apr 12, 2022

Conversation

nnethercote
Copy link
Contributor

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

I think the perf effects here should be negligible.

@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 Apr 8, 2022
@bors
Copy link
Collaborator

bors commented Apr 8, 2022

⌛ Trying commit c09baac998fa0fc3600a8f7f8650c023e9ac8e60 with merge d1dd78813e5e9620703b973bec06c3a6a03c506a...

@bors
Copy link
Collaborator

bors commented Apr 8, 2022

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

@rust-timer
Copy link
Collaborator

Queued d1dd78813e5e9620703b973bec06c3a6a03c506a with parent e745b4d, future comparison URL.

@nnethercote nnethercote changed the title Parse tt a few more tweaks parse_tt: a few more tweaks Apr 8, 2022
@rust-timer
Copy link
Collaborator

Finished benchmarking commit (d1dd78813e5e9620703b973bec06c3a6a03c506a): comparison url.

Summary:

  • Primary benchmarks: 😿 relevant regressions found
  • Secondary benchmarks: 😿 relevant regressions found
Regressions 😿
(primary)
Regressions 😿
(secondary)
Improvements 🎉
(primary)
Improvements 🎉
(secondary)
All 😿 🎉
(primary)
count1 2 6 0 1 2
mean2 0.3% 1.1% N/A -0.3% 0.3%
max 0.4% 1.2% N/A -0.3% 0.4%

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 @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

Footnotes

  1. number of relevant changes

  2. the arithmetic mean of the percent change

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

The slight perf losses will be from the third commit. I guess I'll drop that one.

@@ -441,7 +441,8 @@ pub fn compile_declarative_macro(
let argument_gram = mbe::macro_parser::compute_locs(&sess.parse_sess, &argument_gram);

let parser = Parser::new(&sess.parse_sess, body, true, rustc_parse::MACRO_ARGUMENTS);
let mut tt_parser = TtParser::new(def.ident);
let mut tt_parser =
TtParser::new(Ident::with_dummy_span(if macro_rules { kw::MacroRules } else { kw::Macro }));
Copy link
Contributor

@petrochenkov petrochenkov Apr 8, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is reasonable while we are still matching the macro definition against $( $lhs:tt => $rhs:tt );+ reusing macro_rules machinery.

However, we really should stop pretending that macro_rules! foo { ... } or macro foo (...) { ... } are macro invocations.
This involves removing all the comments saying that, introducing a custom parser for the $( $lhs:tt => $rhs:tt );+ syntax (and its macro 2.0 equivalent), and storing the output from such parser (the lowered macro representation) to crate metadata, so that macro definitions are not reparsed as raw token streams by every dependent crate.

@petrochenkov
Copy link
Contributor

Not much remains from this PR if cc1e815 and 3595a0d are dropped.

@petrochenkov petrochenkov added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Apr 8, 2022
When a `macro_rules! foo { ... }` invocation is compiled the name used
is `foo`, not `macro_rules!`. This is different to all other macro
invocations, and confused me when I was inserted debugging println
statements for macro evaluation.

This commit changes it to `macro_rules` (or just `macro`), which is what
I expected. There are no externally visible changes.
The `Lrc` isn't necessary, neither is the `SmallVec`. Performance is
changed negligibly, but the new code is simpler.
@nnethercote nnethercote force-pushed the parse_tt-a-few-more-tweaks branch from c09baac to edd7f2c Compare April 10, 2022 23:44
@nnethercote
Copy link
Contributor Author

I updated and removed the commit involving missing_fragment_specifiers.

The perf results might have been a weird blip. Let's try again.

@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 Apr 10, 2022
@bors
Copy link
Collaborator

bors commented Apr 10, 2022

⌛ Trying commit edd7f2c with merge f5c9fe83718933285dee8c5664d4f4c5ae540007...

@bors
Copy link
Collaborator

bors commented Apr 11, 2022

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

@rust-timer
Copy link
Collaborator

Queued f5c9fe83718933285dee8c5664d4f4c5ae540007 with parent 1f7fb64, future comparison URL.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (f5c9fe83718933285dee8c5664d4f4c5ae540007): comparison url.

Summary:

  • Primary benchmarks: 😿 relevant regressions found
  • Secondary benchmarks: 🎉 relevant improvement found
Regressions 😿
(primary)
Regressions 😿
(secondary)
Improvements 🎉
(primary)
Improvements 🎉
(secondary)
All 😿 🎉
(primary)
count1 4 0 0 1 4
mean2 0.4% N/A N/A -0.2% 0.4%
max 0.4% N/A N/A -0.2% 0.4%

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.

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

Footnotes

  1. number of relevant changes

  2. the arithmetic mean of the percent change

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

Perf changes are negligible. I think the simplification of removing the Lrc use is worthwhile.

@petrochenkov petrochenkov removed the S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. label Apr 11, 2022
@petrochenkov
Copy link
Contributor

@bors r+

@bors
Copy link
Collaborator

bors commented Apr 12, 2022

📌 Commit edd7f2c has been approved by petrochenkov

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Apr 12, 2022
@petrochenkov
Copy link
Contributor

@bors rollup=maybe

bors added a commit to rust-lang-ci/rust that referenced this pull request Apr 12, 2022
Rollup of 4 pull requests

Successful merges:

 - rust-lang#95783 (rustdoc doctest: include signal number in exit status)
 - rust-lang#95794 (`parse_tt`: a few more tweaks)
 - rust-lang#95963 ([bootstrap] Grab the right FileCheck binary for dist when cross-compiling.)
 - rust-lang#95975 (Don't test -Cdefault-linker-libraries=yes when cross compiling.)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit d684344 into rust-lang:master Apr 12, 2022
@rustbot rustbot added this to the 1.62.0 milestone Apr 12, 2022
@nnethercote nnethercote deleted the parse_tt-a-few-more-tweaks branch April 12, 2022 21:17
@nnethercote
Copy link
Contributor Author

Oh, I forgot to mark this as triaged: see this comment

@rustbot label: +perf-regression-triaged

@rustbot rustbot added the perf-regression-triaged The performance regression has been triaged. label Aug 3, 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-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. 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