Skip to content

Conversation

@joshtriplett
Copy link
Member

Based atop #146849 .

Experiment to see if this impacts performance positively or negatively.

@rustbot rustbot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Sep 21, 2025
@joshtriplett
Copy link
Member Author

@bors try @rust-timer queue

@rust-timer

This comment has been minimized.

@rust-bors

This comment has been minimized.

rust-bors bot added a commit that referenced this pull request Sep 21, 2025
…=<try>

Convert a few builtin macros from `LegacyBang` to `Bang`
@rustbot rustbot added the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Sep 21, 2025
@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@rust-bors
Copy link

rust-bors bot commented Sep 21, 2025

💔 Test for 49a017e failed: CI. Failed jobs:

@joshtriplett joshtriplett force-pushed the macro-reduce-legacy-bang-more branch from 4720187 to 2ede1b3 Compare September 23, 2025 04:16
@joshtriplett
Copy link
Member Author

@bors try @rust-timer queue

@rust-timer

This comment has been minimized.

rust-bors bot added a commit that referenced this pull request Sep 23, 2025
…=<try>

Convert a few builtin macros from `LegacyBang` to `Bang`
@rust-bors

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@rust-bors
Copy link

rust-bors bot commented Sep 23, 2025

💔 Test for 796d6cf failed: CI. Failed jobs:

@joshtriplett joshtriplett force-pushed the macro-reduce-legacy-bang-more branch from 2ede1b3 to 47b1896 Compare September 23, 2025 06:11
@joshtriplett
Copy link
Member Author

@bors try @rust-timer queue

@rust-timer

This comment has been minimized.

@rust-bors

This comment has been minimized.

rust-bors bot added a commit that referenced this pull request Sep 23, 2025
…=<try>

Convert a few builtin macros from `LegacyBang` to `Bang`
@rust-bors
Copy link

rust-bors bot commented Sep 23, 2025

☀️ Try build successful (CI)
Build commit: 9e8be47 (9e8be47f56e72ad50bea013465dee66408998eae, parent: f6092f224d2b1774b31033f12d0bee626943b02f)

@rust-timer

This comment has been minimized.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (9e8be47): comparison URL.

Overall result: ❌✅ regressions and improvements - no action needed

Benchmarking this pull request means it may be perf-sensitive – we'll automatically label it not fit for rolling up. You can override this, but we strongly advise not to, due to possible changes in compiler perf.

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

Instruction count

Our most reliable metric. Used to determine the overall result above. However, even this metric can be noisy.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
0.1% [0.0%, 0.1%] 3
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-0.1% [-0.1%, -0.1%] 1
All ❌✅ (primary) - - 0

Max RSS (memory usage)

Results (primary -1.9%, secondary -4.4%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
-1.9% [-2.5%, -1.1%] 3
Improvements ✅
(secondary)
-4.4% [-4.8%, -3.1%] 9
All ❌✅ (primary) -1.9% [-2.5%, -1.1%] 3

Cycles

Results (secondary 1.2%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
3.3% [2.6%, 4.5%] 3
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-1.9% [-1.9%, -1.9%] 2
All ❌✅ (primary) - - 0

Binary size

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

Bootstrap: 471.715s -> 472.281s (0.12%)
Artifact size: 389.94 MiB -> 387.91 MiB (-0.52%)

@rustbot rustbot removed the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Sep 23, 2025
@petrochenkov petrochenkov self-assigned this Sep 23, 2025
@petrochenkov
Copy link
Contributor

I'll look a bit later, but I rejected something similar a few months ago (#125094 (comment)).
LegacyBang should probably be renamed to something less deprecated-looking.

@joshtriplett
Copy link
Member Author

I'll look a bit later, but I rejected something similar a few months ago (#125094 (comment)). LegacyBang should probably be renamed to something less deprecated-looking.

The only reason I was looking into this was the possibility that macro_rules! might be able to use Bang in the future, once we fully jettison the support for allowing ; in expression macros. (macro_rules! already generates tokens, and AFAICT it's just using the context-sensitive AST-generation support to determine whether it's in an expression context for the purposes of the ; compatibility hack.) I wanted to find out whether, once that happened, it might make sense to convert other macros. Having performance data seemed useful.

It seems roughly performance neutral (seems more like noise from touching macros at all, rather than anything to do with line/column), but at the same time, it does seem like a waste of time to go through tokens rather than AST.

I'm going to close this; it's not worth reviewing.

@rustbot rustbot removed the S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. label Sep 23, 2025
@joshtriplett joshtriplett deleted the macro-reduce-legacy-bang-more branch September 23, 2025 17:32
@petrochenkov
Copy link
Contributor

the possibility that macro_rules! might be able to use Bang in the future

Yeah, for macro_rules switching to a "tokens -> tokens" expander makes sense.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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.

5 participants