Skip to content

Use PGO for Cargo#159149

Draft
Kobzol wants to merge 7 commits into
rust-lang:mainfrom
Kobzol:bootstrap-pgo-cargo
Draft

Use PGO for Cargo#159149
Kobzol wants to merge 7 commits into
rust-lang:mainfrom
Kobzol:bootstrap-pgo-cargo

Conversation

@Kobzol

@Kobzol Kobzol commented Jul 11, 2026

Copy link
Copy Markdown
Member

View all comments

Based on #159091.

I downloaded the built Cargo and compared it with the parent commit locally on bors (which is of course not in the PGO training set). The results are quite nice:

Benchmark 1 (26 runs): cargo +babf6ea4aab9ed78ea9400b25b0e7e79a6870f29 test --no-run
  measurement          mean ± σ            min … max           outliers         delta
  wall_time           192ms ± 6.95ms     188ms …  226ms          1 ( 4%)        0%
  peak_rss           96.3MB ±  354KB    95.6MB … 96.9MB          0 ( 0%)        0%
  cpu_cycles          454M  ± 5.92M      448M  …  480M           1 ( 4%)        0%
  instructions        797M  ± 5.68M      796M  …  825M           1 ( 4%)        0%
  cache_references   32.7M  ±  352K     32.0M  … 34.0M           1 ( 4%)        0%
  cache_misses       8.82M  ± 86.9K     8.67M  … 9.10M           1 ( 4%)        0%
  branch_misses      3.76M  ± 41.3K     3.72M  … 3.93M           1 ( 4%)        0%

Benchmark 2 (28 runs): cargo +b2aa8c0474895b96828df9c09182952caf6f6450 test --no-run
  measurement          mean ± σ            min … max           outliers         delta
  wall_time           185ms ± 7.07ms     175ms …  208ms          1 ( 4%)        ⚡-  3.9% ±  2.0%
  peak_rss           90.9MB ±  207KB    90.4MB … 91.3MB          1 ( 4%)        ⚡-  5.6% ±  0.2%
  cpu_cycles          420M  ± 9.31M      406M  …  440M           0 ( 0%)        ⚡-  7.7% ±  0.9%
  instructions        736M  ± 5.47M      735M  …  764M           1 ( 4%)        ⚡-  7.6% ±  0.4%
  cache_references   26.2M  ±  406K     25.7M  … 28.0M           2 ( 7%)        ⚡- 19.9% ±  0.6%
  cache_misses       6.01M  ± 92.7K     5.85M  … 6.28M           1 ( 4%)        ⚡- 31.8% ±  0.6%
  branch_misses      3.47M  ± 55.9K     3.40M  … 3.69M           1 ( 4%)        ⚡-  7.6% ±  0.7%

~7.5% icount improvement, that's pretty cool.

@rustbot rustbot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) labels Jul 11, 2026
@Kobzol

Kobzol commented Jul 11, 2026

Copy link
Copy Markdown
Member 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 Jul 11, 2026
@rust-bors

This comment has been minimized.

rust-bors Bot pushed a commit that referenced this pull request Jul 11, 2026
@rust-bors

rust-bors Bot commented Jul 11, 2026

Copy link
Copy Markdown
Contributor

💔 Test for 0109abd failed: CI. Failed job:

@rust-log-analyzer

This comment has been minimized.

@Kobzol Kobzol force-pushed the bootstrap-pgo-cargo branch from 5b7c55c to 6fc8fbe Compare July 11, 2026 21:31
@Kobzol

Kobzol commented Jul 11, 2026

Copy link
Copy Markdown
Member Author

@bors try

@rust-bors

This comment has been minimized.

rust-bors Bot pushed a commit that referenced this pull request Jul 11, 2026
@rust-bors

rust-bors Bot commented Jul 11, 2026

Copy link
Copy Markdown
Contributor

💔 Test for 7353424 failed: CI. Failed job:

@rust-log-analyzer

This comment has been minimized.

@Kobzol Kobzol force-pushed the bootstrap-pgo-cargo branch from 6fc8fbe to f96c8fe Compare July 12, 2026 08:48
@Kobzol

Kobzol commented Jul 12, 2026

Copy link
Copy Markdown
Member Author

@bors try

@rust-bors

This comment has been minimized.

rust-bors Bot pushed a commit that referenced this pull request Jul 12, 2026
@rust-bors

rust-bors Bot commented Jul 12, 2026

Copy link
Copy Markdown
Contributor

💔 Test for 1f59755 failed: CI. Failed job:

@rust-log-analyzer

This comment has been minimized.

@Kobzol Kobzol force-pushed the bootstrap-pgo-cargo branch from f96c8fe to 1a74d3b Compare July 12, 2026 11:31
@Kobzol

Kobzol commented Jul 12, 2026

Copy link
Copy Markdown
Member Author

@bors try

@rust-bors

This comment has been minimized.

rust-bors Bot pushed a commit that referenced this pull request Jul 12, 2026
@rust-bors

rust-bors Bot commented Jul 12, 2026

Copy link
Copy Markdown
Contributor

💔 Test for cf8ac50 failed: CI. Failed job:

@rust-log-analyzer

This comment has been minimized.

@Kobzol

Kobzol commented Jul 12, 2026

Copy link
Copy Markdown
Member Author

@bors try

@rust-bors

This comment has been minimized.

rust-bors Bot pushed a commit that referenced this pull request Jul 12, 2026
@rust-bors

rust-bors Bot commented Jul 12, 2026

Copy link
Copy Markdown
Contributor

💔 Test for b222323 failed: CI. Failed job:

@rust-log-analyzer

This comment has been minimized.

@Kobzol Kobzol force-pushed the bootstrap-pgo-cargo branch from 4b6e65f to 1b3ef71 Compare July 12, 2026 13:37
@Kobzol

Kobzol commented Jul 12, 2026

Copy link
Copy Markdown
Member Author

@bors try

@rust-bors

This comment has been minimized.

rust-bors Bot pushed a commit that referenced this pull request Jul 12, 2026
@rust-bors

rust-bors Bot commented Jul 12, 2026

Copy link
Copy Markdown
Contributor

☀️ Try build successful (CI)
Build commit: b2aa8c0 (b2aa8c0474895b96828df9c09182952caf6f6450)
Base parent: babf6ea (babf6ea4aab9ed78ea9400b25b0e7e79a6870f29)

@rust-timer

This comment has been minimized.

@rust-timer

Copy link
Copy Markdown
Collaborator

Finished benchmarking commit (b2aa8c0): comparison URL.

Overall result: ❌✅ regressions and improvements - please read:

Benchmarking means the PR may be perf-sensitive. It's automatically marked not fit for rolling up. Overriding is possible but disadvised: it risks changing compiler perf.

Next, please: If you can, justify the regressions found in this try perf run in writing along with @rustbot label: +perf-regression-triaged. If not, fix the regressions and do another perf run. Neutral or positive results will clear the label automatically.

@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.5% [0.3%, 0.9%] 11
Regressions ❌
(secondary)
0.6% [0.1%, 4.5%] 31
Improvements ✅
(primary)
-2.6% [-6.4%, -0.2%] 34
Improvements ✅
(secondary)
-2.5% [-8.2%, -0.2%] 51
All ❌✅ (primary) -1.9% [-6.4%, 0.9%] 45

Max RSS (memory usage)

Results (primary 4.3%, secondary 3.7%)

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

mean range count
Regressions ❌
(primary)
4.3% [3.7%, 4.9%] 2
Regressions ❌
(secondary)
3.7% [2.2%, 5.4%] 4
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 4.3% [3.7%, 4.9%] 2

Cycles

Results (primary -3.3%, 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)
3.4% [3.4%, 3.4%] 1
Regressions ❌
(secondary)
7.0% [3.2%, 14.0%] 3
Improvements ✅
(primary)
-3.7% [-5.4%, -2.2%] 18
Improvements ✅
(secondary)
-4.3% [-7.5%, -2.6%] 25
All ❌✅ (primary) -3.3% [-5.4%, 3.4%] 19

Binary size

This perf run didn't have relevant results for this metric.

Bootstrap: 490.525s -> 491.031s (0.10%)
Artifact size: 389.30 MiB -> 390.59 MiB (0.33%)

@rustbot rustbot added perf-regression Performance regression. and removed S-waiting-on-perf Status: Waiting on a perf run to be completed. labels Jul 12, 2026
@Kobzol Kobzol mentioned this pull request Jul 12, 2026
@Kobzol

Kobzol commented Jul 12, 2026

Copy link
Copy Markdown
Member Author

@bors try jobs=dist-x86_64-linux

Trying full CI duration.

@rust-bors

This comment has been minimized.

rust-bors Bot pushed a commit that referenced this pull request Jul 12, 2026
Use PGO for Cargo


try-job: dist-x86_64-linux
@rust-bors

rust-bors Bot commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

☀️ Try build successful (CI)
Build commit: efbd9eb (efbd9ebd1dbc681e6096b386f0aeb8f616a52574)
Base parent: 77cf889 (77cf889bc178ddb44d6a1c78e5a820b5abb31d8d)

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-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants