Skip to content

Span tweaks #115594

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

Merged
merged 2 commits into from
Sep 9, 2023
Merged

Span tweaks #115594

merged 2 commits into from
Sep 9, 2023

Conversation

nnethercote
Copy link
Contributor

Some minor improvements to code clarity.

r? @cjgillot

@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 Sep 6, 2023
@nnethercote
Copy link
Contributor Author

There are a couple of njn comments for things I'm uncertain about. In particular, the parent field seems like it isn't used unless -Zincremental-relative-spans is used, is that right? Is there any prospect of that being made the default? It's a fair amount of extra complication handling parents if it's never used in practice.

@nnethercote
Copy link
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 Sep 6, 2023
@bors
Copy link
Collaborator

bors commented Sep 6, 2023

⌛ Trying commit c1ed001 with merge 763c9690726b89db9e879e72cb326e6dacc79ccc...

@bors
Copy link
Collaborator

bors commented Sep 6, 2023

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

@rust-timer

This comment has been minimized.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (763c9690726b89db9e879e72cb326e6dacc79ccc): comparison URL.

Overall result: ❌✅ regressions and improvements - 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.

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-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.4% [0.4%, 0.4%] 6
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
-0.4% [-0.4%, -0.4%] 2
Improvements ✅
(secondary)
-0.4% [-0.5%, -0.3%] 7
All ❌✅ (primary) 0.2% [-0.4%, 0.4%] 8

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)
1.3% [0.6%, 4.2%] 8
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-2.4% [-2.4%, -2.4%] 1
All ❌✅ (primary) 1.3% [0.6%, 4.2%] 8

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

Binary size

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

Bootstrap: 627.677s -> 626.896s (-0.12%)
Artifact size: 316.18 MiB -> 316.54 MiB (0.11%)

@rustbot rustbot added perf-regression Performance regression. and removed S-waiting-on-perf Status: Waiting on a perf run to be completed. labels Sep 7, 2023
Comment on lines 73 to 77
/// njn: this comment is nonsensical, what is it supposed to say?
/// In order to reliably use parented spans in incremental compilation,
/// the dependency to the parent definition's span. This is performed
/// using the callback `SPAN_TRACK` to access the query engine.
///
Copy link
Contributor

Choose a reason for hiding this comment

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

in relative span mode, we hide part of the information contained in the span from the query system. The Span actually holds lo, hi and ctxt, but the query system thinks it only holds offset from parent's span lo, hi - lo and ctxt. This file is responsible for the encapsulation. The conversion is meant to happen in data_untracked (untracked by the query system), and data which tracks it for the query system by calling SPAN_TRACK. No code should access lo or hi other that through one of these methods.

`Span` has undergone some changes over the years (addition of an optional
parent, and possible inlining of the context in interned spans) but the
comments and identifiers used haven't kept up. As a result, I find it
harder to understand than I should.

This commit reworks the comments, renames some identifiers, and
restructures the code slightly, all to make things clearer. I now feel
like I understand this code again.
It's quite hot, and worth having a version that works directly at the
`Span` level, rather than first converting to the `SpanData` level.
@nnethercote
Copy link
Contributor Author

@cjgillot: I have updated to remove the njn comments. This is now ready for review. Thanks!

@cjgillot
Copy link
Contributor

cjgillot commented Sep 9, 2023

@bors r+

@bors
Copy link
Collaborator

bors commented Sep 9, 2023

📌 Commit 5790372 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 Sep 9, 2023
@bors
Copy link
Collaborator

bors commented Sep 9, 2023

⌛ Testing commit 5790372 with merge 6cc1898...

@bors
Copy link
Collaborator

bors commented Sep 9, 2023

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

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Sep 9, 2023
@bors bors merged commit 6cc1898 into rust-lang:master Sep 9, 2023
@rustbot rustbot added this to the 1.74.0 milestone Sep 9, 2023
@rust-timer
Copy link
Collaborator

Finished benchmarking commit (6cc1898): 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.4% [-0.4%, -0.4%] 1
Improvements ✅
(secondary)
-0.4% [-0.5%, -0.3%] 6
All ❌✅ (primary) -0.4% [-0.4%, -0.4%] 1

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)
1.0% [0.7%, 1.2%] 7
Regressions ❌
(secondary)
2.5% [2.5%, 2.6%] 2
Improvements ✅
(primary)
-1.2% [-1.2%, -1.1%] 2
Improvements ✅
(secondary)
-1.9% [-1.9%, -1.8%] 2
All ❌✅ (primary) 0.5% [-1.2%, 1.2%] 9

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: 628.91s -> 627.323s (-0.25%)
Artifact size: 318.15 MiB -> 318.09 MiB (-0.02%)

@rustbot rustbot removed the perf-regression Performance regression. label Sep 9, 2023
@nnethercote nnethercote deleted the span-tweaks branch September 10, 2023 22:29
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.

5 participants