Skip to content

Split DepGraph::read_index in two.#153800

Draft
nnethercote wants to merge 1 commit intorust-lang:mainfrom
nnethercote:split-read_index
Draft

Split DepGraph::read_index in two.#153800
nnethercote wants to merge 1 commit intorust-lang:mainfrom
nnethercote:split-read_index

Conversation

@nnethercote
Copy link
Contributor

DepGraph::read_index is a reasonably large function and it is currently inlined into query_get_at which is very hot and instantiated many times.

The compiler becomes smaller and faster if we inline only the outermost check. (This check always fails in non-incremental builds and always succeeds in incremental builds).

Note: this pattern of having a method in DepGraph and another one with the same name in DepGraphData is well established, e.g. try_mark_green, node_color, encode_side_effect.

@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 Mar 13, 2026
@nnethercote
Copy link
Contributor Author

@bors try @rust-timer queue

@rust-timer

This comment has been minimized.

@rust-bors

This comment has been minimized.

rust-bors bot pushed a commit that referenced this pull request Mar 13, 2026
Split `DepGraph::read_index` in two.
@rustbot rustbot added the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Mar 13, 2026
@rust-log-analyzer

This comment has been minimized.

`DepGraph::read_index` is a reasonably large function and it is
currently inlined into `query_get_at` which is very hot and instantiated
many times.

The compiler becomes smaller and faster if we inline only the outermost
check. (This check always fails in non-incremental builds and always
succeeds in incremental builds).

Note: this pattern of having a method in `DepGraph` and another one with
the same name in `DepGraphData` is well established, e.g.
`try_mark_green`, `node_color`, `encode_side_effect`.
@nnethercote
Copy link
Contributor Author

@bors try cancel

@rust-bors
Copy link
Contributor

rust-bors bot commented Mar 13, 2026

Try build cancelled. Cancelled workflows:

@nnethercote
Copy link
Contributor Author

@bors try @rust-timer queue

@rust-timer

This comment has been minimized.

@rust-bors

This comment has been minimized.

rust-bors bot pushed a commit that referenced this pull request Mar 13, 2026
Split `DepGraph::read_index` in two.
@rust-bors
Copy link
Contributor

rust-bors bot commented Mar 13, 2026

☀️ Try build successful (CI)
Build commit: e9658c4 (e9658c4f4597c5eb9f24368cbaa5db617f76e99a, parent: 4efe3dc40fdd5ed3d001e7736ff384f2d21d7361)

@rust-timer

This comment has been minimized.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (e9658c4): comparison URL.

Overall result: ❌✅ regressions and improvements - please read the text below

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.

Next Steps: If you can justify the regressions found in this try perf run, please do so in sufficient writing along with @rustbot label: +perf-regression-triaged. If not, please fix the regressions and do another perf run. If its results are neutral or positive, the label will be automatically removed.

@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.3% [0.1%, 0.5%] 68
Regressions ❌
(secondary)
0.4% [0.0%, 1.0%] 40
Improvements ✅
(primary)
-0.3% [-0.4%, -0.1%] 13
Improvements ✅
(secondary)
-0.6% [-1.7%, -0.1%] 10
All ❌✅ (primary) 0.2% [-0.4%, 0.5%] 81

Max RSS (memory usage)

Results (primary -2.5%, secondary 0.3%)

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.7% [2.7%, 2.7%] 1
Improvements ✅
(primary)
-2.5% [-2.5%, -2.5%] 1
Improvements ✅
(secondary)
-0.9% [-0.9%, -0.8%] 2
All ❌✅ (primary) -2.5% [-2.5%, -2.5%] 1

Cycles

Results (secondary -2.8%)

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

Binary size

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

Bootstrap: 482.458s -> 478.131s (-0.90%)
Artifact size: 394.92 MiB -> 394.78 MiB (-0.04%)

@rustbot rustbot added perf-regression Performance regression. and removed S-waiting-on-perf Status: Waiting on a perf run to be completed. labels Mar 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

perf-regression Performance regression. 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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants