Skip to content

rustc_span: Optimize syntax context comparisons#119531

Merged
bors merged 1 commit into
rust-lang:masterfrom
petrochenkov:cmpctxt
Jan 6, 2024
Merged

rustc_span: Optimize syntax context comparisons#119531
bors merged 1 commit into
rust-lang:masterfrom
petrochenkov:cmpctxt

Conversation

@petrochenkov

Copy link
Copy Markdown
Contributor

Including comparisons with root context.

  • eq_ctxt doesn't require retrieving full SpanData, or taking the span interner lock twice.
  • Checking SyntaxContext for "rootness" is cheaper than extracting a full outer ExpnData for it and checking it for rootness.

The internal lint for eq_ctxt is also tweaked to detect a.ctxt() != b.ctxt() in addition to a.ctxt() == b.ctxt().

@rustbot

rustbot commented Jan 2, 2024

Copy link
Copy Markdown
Collaborator

r? @TaKO8Ki

(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 Jan 2, 2024
@petrochenkov

Copy link
Copy Markdown
Contributor Author

@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 Jan 2, 2024
@petrochenkov petrochenkov removed the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jan 2, 2024
@bors

bors commented Jan 2, 2024

Copy link
Copy Markdown
Collaborator

⌛ Trying commit 7db910c with merge 5adf01d...

bors added a commit to rust-lang-ci/rust that referenced this pull request Jan 2, 2024
rustc_span: Optimize syntax context comparisons

Including comparisons with root context.

- `eq_ctxt` doesn't require retrieving full `SpanData`, or taking the span interner lock twice.
- Checking `SyntaxContext` for "rootness" is cheaper than extracting a full outer `ExpnData` for it and checking *it* for rootness.

The internal lint for `eq_ctxt` is also tweaked to detect `a.ctxt() != b.ctxt()` in addition to `a.ctxt() == b.ctxt()`.
@rust-log-analyzer

This comment has been minimized.

@bors

bors commented Jan 3, 2024

Copy link
Copy Markdown
Collaborator

☀️ Try build successful - checks-actions
Build commit: 5adf01d (5adf01dde4bb9a30a7fb49224735fb7267260b4a)

@rust-timer

This comment has been minimized.

@rust-timer

Copy link
Copy Markdown
Collaborator

Finished benchmarking commit (5adf01d): 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.7% [-0.8%, -0.4%] 5
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) -0.7% [-0.8%, -0.4%] 5

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

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

Binary size

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

Bootstrap: 666.95s -> 668.373s (0.21%)
Artifact size: 311.74 MiB -> 311.75 MiB (0.00%)

@rustbot rustbot removed the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Jan 3, 2024
@TaKO8Ki

TaKO8Ki commented Jan 3, 2024

Copy link
Copy Markdown
Member

@rustbot author

@rustbot rustbot added the S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. label Jan 3, 2024
@rustbot

rustbot commented Jan 3, 2024

Copy link
Copy Markdown
Collaborator

Some changes occurred in src/tools/clippy

cc @rust-lang/clippy

@petrochenkov

Copy link
Copy Markdown
Contributor Author

Apparently this machinery is typically used from diagnostics, so there's not much difference.
@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 Jan 3, 2024
@cjgillot

cjgillot commented Jan 3, 2024

Copy link
Copy Markdown
Contributor

@bors r+

@bors

bors commented Jan 3, 2024

Copy link
Copy Markdown
Collaborator

📌 Commit 1945792 has been approved by cjgillot

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 Jan 3, 2024
@bors

This comment was marked as resolved.

@bors bors 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-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Jan 5, 2024
Including comparisons with root context
@petrochenkov

Copy link
Copy Markdown
Contributor Author

@bors r=cjgillot

@bors

bors commented Jan 5, 2024

Copy link
Copy Markdown
Collaborator

📌 Commit 90d11d6 has been approved by cjgillot

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-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Jan 5, 2024
@bors

bors commented Jan 6, 2024

Copy link
Copy Markdown
Collaborator

⌛ Testing commit 90d11d6 with merge 9212108...

@bors

bors commented Jan 6, 2024

Copy link
Copy Markdown
Collaborator

☀️ Test successful - checks-actions
Approved by: cjgillot
Pushing 9212108 to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Jan 6, 2024
@bors bors merged commit 9212108 into rust-lang:master Jan 6, 2024
@rustbot rustbot added this to the 1.77.0 milestone Jan 6, 2024
@rust-timer

Copy link
Copy Markdown
Collaborator

Finished benchmarking commit (9212108): comparison URL.

Overall result: ✅ improvements - no action needed

@rustbot label: -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.6% [-0.8%, -0.4%] 5
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) -0.6% [-0.8%, -0.4%] 5

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)
- - 0
Regressions ❌
(secondary)
5.8% [2.2%, 10.7%] 3
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-2.9% [-3.7%, -2.0%] 2
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.

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

Binary size

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

Bootstrap: 665.507s -> 668.835s (0.50%)
Artifact size: 308.52 MiB -> 308.53 MiB (0.01%)

flip1995 pushed a commit to flip1995/rust that referenced this pull request Jan 11, 2024
rustc_span: Optimize syntax context comparisons

Including comparisons with root context.

- `eq_ctxt` doesn't require retrieving full `SpanData`, or taking the span interner lock twice.
- Checking `SyntaxContext` for "rootness" is cheaper than extracting a full outer `ExpnData` for it and checking *it* for rootness.

The internal lint for `eq_ctxt` is also tweaked to detect `a.ctxt() != b.ctxt()` in addition to `a.ctxt() == b.ctxt()`.
@petrochenkov petrochenkov deleted the cmpctxt branch February 22, 2025 18:39
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. 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.

7 participants