Skip to content

Conversation

@azhogin
Copy link
Contributor

@azhogin azhogin commented Sep 22, 2025

source_span query renamed to source_span_q.
source_span inlined function implemented to call source_span implementation in case of non-incremental build and call query otherwise.

Some other queries may be optimized in a such way.
Statistics prepared (queries with small 'avg_ns_norm' and big 'cache_hits' may be optimized):
Non-feedable only and cache_hits > 500:
queries_stat_non_feedable.csv

@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 22, 2025
@petrochenkov petrochenkov self-assigned this Sep 23, 2025
@petrochenkov
Copy link
Contributor

@bors2 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
source_span hook in case of non-incremental build
@rustbot rustbot added the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Sep 23, 2025
@petrochenkov petrochenkov 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
@rust-bors
Copy link

rust-bors bot commented Sep 23, 2025

☀️ Try build successful (CI)
Build commit: 396339e (396339e6a2c138a7c89886391a30bf6ba178ed8a, parent: 40560823602064f4c726aea3e15e104449e1a392)

@rust-timer

This comment has been minimized.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (396339e): comparison URL.

Overall result: ✅ 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
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-0.5% [-0.7%, -0.3%] 2
All ❌✅ (primary) - - 0

Max RSS (memory usage)

Results (primary -2.9%)

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

Cycles

Results (secondary -1.6%)

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)
2.8% [2.3%, 3.4%] 3
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-3.5% [-4.7%, -2.1%] 7
All ❌✅ (primary) - - 0

Binary size

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

Bootstrap: 472.868s -> 472.157s (-0.15%)
Artifact size: 389.97 MiB -> 389.93 MiB (-0.01%)

@rustbot rustbot removed the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Sep 23, 2025
@petrochenkov petrochenkov added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Sep 23, 2025
@zetanumbers
Copy link
Contributor

zetanumbers commented Sep 24, 2025

queries_stat.csv

This stats were derived from collected data about individual query calls/executions during a compilation (or rather a check) on the serde crate. In case anyone finds this data useful.

Details here: #t-compiler > How does the option `query_dep_graph` work? @ 💬

@petrochenkov
Copy link
Contributor

Could you change this to a version that checks the incremental flag every time instead of introducing a hook?
@rustbot author

@rustbot rustbot 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 Sep 25, 2025
@rustbot
Copy link
Collaborator

rustbot commented Sep 25, 2025

Reminder, once the PR becomes ready for a review, use @rustbot ready.

@azhogin azhogin force-pushed the azhogin/source_span_hook branch from 6123d0a to f70366e Compare September 25, 2025 14:40
@azhogin
Copy link
Contributor Author

azhogin commented Sep 25, 2025

Could you change this to a version that checks the incremental flag every time instead of introducing a hook?

Changed.
@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 Sep 25, 2025
@petrochenkov petrochenkov 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 Sep 25, 2025
@azhogin azhogin force-pushed the azhogin/source_span_hook branch from f70366e to 30de58e Compare September 25, 2025 15:59
@azhogin
Copy link
Contributor Author

azhogin commented Sep 25, 2025

@rustbot ready

@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 25, 2025
@rustbot rustbot removed the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Sep 25, 2025
@petrochenkov
Copy link
Contributor

Ok, now this looks like a legitimate improvement, but why does it happen in incr-full mode, I don't think it should?

The PR title and description need to be updated before I send this to someone with better query system expertize.
The files with statistics in particular are irrelevant to the change itself.

@petrochenkov petrochenkov marked this pull request as ready for review September 25, 2025 22:45
@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Sep 25, 2025
@petrochenkov petrochenkov 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 Sep 25, 2025
@azhogin azhogin changed the title source_span hook in case of non-incremental build source_span query optimized to be inlined function in case of non-incremental build Sep 26, 2025
@petrochenkov petrochenkov 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 Sep 29, 2025
@petrochenkov
Copy link
Contributor

In the incr-full scenarios the old source_span is still called, under the new name source_span_q, and with the same number of executions and hits (218 and 19357).
It means the wg-grammar change is also noise, after all.

Let's rerun perf on the new master just in case.
@bors2 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 29, 2025
source_span query optimized to be inlined function in case of non-incremental build
@rustbot rustbot added the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Sep 29, 2025
@petrochenkov
Copy link
Contributor

If the difference is indeed noise, it means that either:

  • Query system overhead in non-incremental case is not larger than a synchronized map lookup like tcx.untracked.source_span.get(...).
  • Or the query is just not called often enough to see the difference.

@petrochenkov petrochenkov removed the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Sep 29, 2025
@cjgillot cjgillot self-assigned this Sep 29, 2025
@rust-bors
Copy link

rust-bors bot commented Sep 29, 2025

☀️ Try build successful (CI)
Build commit: 13bb904 (13bb904abf88308cb050948b3af4c7e2363fffa3, parent: 21a13b8864a7dd614e9a96afd57b58c7fcf0bd6b)

@rust-timer

This comment has been minimized.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (13bb904): comparison URL.

Overall result: no relevant changes - 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

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

Max RSS (memory usage)

Results (primary -2.5%, secondary 3.1%)

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

mean range count
Regressions ❌
(primary)
2.1% [2.1%, 2.1%] 1
Regressions ❌
(secondary)
3.1% [3.1%, 3.1%] 1
Improvements ✅
(primary)
-7.0% [-7.0%, -7.0%] 1
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) -2.5% [-7.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: 470.943s -> 470.808s (-0.03%)
Artifact size: 387.66 MiB -> 387.65 MiB (-0.00%)

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

Yeah, it's noise.
(I'll leave this open since cjgillot self-assigned.)

@petrochenkov
Copy link
Contributor

#147387 (comment)

@rustbot rustbot removed the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Dec 8, 2025
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.

6 participants