-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
Call compute_locs
once per rule
#95669
Call compute_locs
once per rule
#95669
Conversation
It's a slight performance loss for now, but that will be recouped by the next commit.
In rust-lang#95555 this was moved out of `parse_tt_inner` and `nameize` into `compute_locs`. But the next commit will be moving `compute_locs` outwards to a place that isn't suitable for the missing fragment identifier checking. So this reinstates the old checking.
@bors try @rust-timer queue |
Awaiting bors try build completion. @rustbot label: +S-waiting-on-perf |
⌛ Trying commit a68238b68f9fd4adbe9ea196d1473c297577fb32 with merge 6db6a2df45e20133e0d7c5f7353baf3c5e94e711... |
Local instruction count measurements on
|
Why isn't it suitable? |
I guess the next logical step is lowering macros to |
☀️ Try build successful - checks-actions |
Queued 6db6a2df45e20133e0d7c5f7353baf3c5e94e711 with parent 949b98c, future comparison URL. |
Finished benchmarking commit (6db6a2df45e20133e0d7c5f7353baf3c5e94e711): comparison url. Summary:
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. @bors rollup=never Footnotes |
Currently it's called in `parse_tt` every time a match rule is invoked. This commit moves it so it's called instead once per match rule, in `compile_declarative_macro. This is a performance win. The commit also moves `compute_locs` out of `TtParser`, because there's no longer any reason for it to be in there.
a68238b
to
238d907
Compare
I wish this was true, because I would like to remove
Here's the current compiler output:
Note that the two errors are different. Even worse, if you add Based on this, if we want to keep the current behaviour, we need to keep the checking during macro expansion. If you think it's reasonable to change the behaviour here, I'd prefer to do it in a follow-up, to keep this PR just about performance improvements. Therefore, I have kept the checking in the macro expansion phase for now. |
@nnethercote macro_rules! m_unused { ( $id ) => {} } an error. Previously it wasn't possible to catch missing specifiers at definition site without a significant rewrite, so the old implementation caught them at call site on a best effort basis. |
@bors r+ |
📌 Commit 238d907 has been approved by |
☀️ Test successful - checks-actions |
Thanks. I just looked over the history here, these issues/PRs are relevant: #40107, #63239, #75516, #76605, #80296. Seems like this has been tried in the past and had to be reverted due to widespread breakage? What steps are required for this? Would the |
No, no, I suggest to keep it as a lint, as it is now, just report in at definition site (and even if the macro is unused). |
Finished benchmarking commit (c2afaba): comparison url. Summary:
If you disagree with this performance assessment, please file an issue in rust-lang/rustc-perf. @rustbot label: -perf-regression Footnotes |
This fixes the small regressions on
wg-grammar
andhyper-0.14.18
seen in #95555.r? @petrochenkov