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

perform TokenStream replacement in-place when possible in expand_macro #113270

Merged
merged 2 commits into from
Jul 7, 2023

Conversation

the8472
Copy link
Member

@the8472 the8472 commented Jul 2, 2023

No description provided.

@rustbot
Copy link
Collaborator

rustbot commented Jul 2, 2023

r? @nnethercote

(rustbot has picked a reviewer for you, use r? to override)

@rustbot rustbot added 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. labels Jul 2, 2023
@the8472
Copy link
Member Author

the8472 commented Jul 2, 2023

@bors try @rust-timer queue

@rust-timer

This comment has been minimized.

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

bors commented Jul 2, 2023

⌛ Trying commit 25ee6bdc495bf8b3025713697cbd61172fa283de with merge 360c11b3de4d5ce4aa75e11bc173d681b85c194d...

@bors
Copy link
Contributor

bors commented Jul 2, 2023

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

@rust-timer

This comment has been minimized.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (360c11b3de4d5ce4aa75e11bc173d681b85c194d): comparison URL.

Overall result: ✅ improvements - no 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.

@bors rollup=never
@rustbot label: -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.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
-0.4% [-0.6%, -0.3%] 2
Improvements ✅
(secondary)
-0.2% [-0.3%, -0.2%] 2
All ❌✅ (primary) -0.4% [-0.6%, -0.3%] 2

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.

mean range count
Regressions ❌
(primary)
2.7% [2.0%, 3.3%] 2
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
-0.9% [-1.5%, -0.6%] 4
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 0.3% [-1.5%, 3.3%] 6

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.

mean range count
Regressions ❌
(primary)
0.5% [0.5%, 0.5%] 2
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 0.5% [0.5%, 0.5%] 2

Binary size

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

Bootstrap: 661.67s -> 661.96s (0.04%)

@rustbot rustbot removed the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Jul 2, 2023
compiler/rustc_ast/src/tokenstream.rs Outdated Show resolved Hide resolved
if let Some(inner) = Lrc::get_mut(&mut self.0) {
let owned = mem::take(inner);
*inner = owned.into_iter().enumerate().map(|(i, tree)| f(i, tree)).collect();
return self;
Copy link
Contributor

Choose a reason for hiding this comment

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

I think putting the subsequent code in an else block would be better than the early return.

Alternatively, is there a way to combine the two blocks using make_mut somehow?

Copy link
Member Author

Choose a reason for hiding this comment

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

make_mut might work. Though its allocation behavior is slightly different, doing the deep clone up-front instead of incrementally so that could have some effect.

@nnethercote nnethercote 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 Jul 3, 2023
@the8472
Copy link
Member Author

the8472 commented Jul 3, 2023

@rustbot ready

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Jul 3, 2023
@nnethercote
Copy link
Contributor

@bors r+

@bors
Copy link
Contributor

bors commented Jul 7, 2023

📌 Commit 7916a2c has been approved by nnethercote

It is now in the queue for this repository.

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

bors commented Jul 7, 2023

⌛ Testing commit 7916a2c with merge 921f669...

@bors
Copy link
Contributor

bors commented Jul 7, 2023

☀️ Test successful - checks-actions
Approved by: nnethercote
Pushing 921f669 to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Jul 7, 2023
@bors bors merged commit 921f669 into rust-lang:master Jul 7, 2023
@rustbot rustbot added this to the 1.72.0 milestone Jul 7, 2023
@rust-timer
Copy link
Collaborator

Finished benchmarking commit (921f669): comparison URL.

Overall result: ❌✅ regressions and improvements - ACTION NEEDED

Next Steps: If you can justify the regressions found in this perf run, please indicate this with @rustbot label: +perf-regression-triaged along with sufficient written justification. If you cannot justify the regressions please open an issue or create a new PR that fixes the regressions, add a comment linking to the newly created issue or PR, and then add the perf-regression-triaged label to this PR.

@rustbot label: +perf-regression
cc @rust-lang/wg-compiler-performance

Instruction count

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

mean range count
Regressions ❌
(primary)
0.6% [0.6%, 0.7%] 2
Regressions ❌
(secondary)
0.3% [0.3%, 0.3%] 3
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-0.3% [-0.3%, -0.3%] 2
All ❌✅ (primary) 0.6% [0.6%, 0.7%] 2

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.

mean range count
Regressions ❌
(primary)
2.1% [2.0%, 2.1%] 2
Regressions ❌
(secondary)
3.3% [3.3%, 3.3%] 1
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 2.1% [2.0%, 2.1%] 2

Cycles

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

Binary size

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

Bootstrap: 658.984s -> 658.878s (-0.02%)

@rustbot rustbot added the perf-regression Performance regression. label Jul 7, 2023
@lqd
Copy link
Member

lqd commented Jul 7, 2023

These look like the short periodic noise spikes we have (daily or so ?) on these benchmarks.

@the8472
Copy link
Member Author

the8472 commented Jul 7, 2023

possibly, I'll do a test run later to see if the allocation ordering makes a difference.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
merged-by-bors This PR was explicitly merged by bors. perf-regression Performance regression. 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