Skip to content

Defer extra liveness calculation for Polonius Alpha - #161938

Open
jackh726 wants to merge 5 commits into
rust-lang:mainfrom
jackh726:polonius-lazy-liveness-final
Open

jackh726 wants to merge 5 commits into
rust-lang:mainfrom
jackh726:polonius-lazy-liveness-final

Conversation

@jackh726

@jackh726 jackh726 commented Aug 28, 2026

Copy link
Copy Markdown
Member

View all comments

Best reviewed by commit.

This moves liveness calculation of NLL-boring/Polonius-relevant locals to be lazy. This allows us to skip unnecessary work.

r? lqd

@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 Aug 28, 2026
@rustbot rustbot added the T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. label Aug 28, 2026
@jackh726

Copy link
Copy Markdown
Member Author

@bors try @rust-time queue

@rust-bors

This comment has been minimized.

rust-bors Bot pushed a commit that referenced this pull request Aug 28, 2026
Defer extra liveness calculation for Polonius Alpha
@jackh726

Copy link
Copy Markdown
Member Author

@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 Aug 28, 2026
@jackh726

Copy link
Copy Markdown
Member Author

Disclosure: An LLM was used for experiments here, but all code here is written fresh.

@rust-log-analyzer

This comment has been minimized.

@rust-bors

rust-bors Bot commented Aug 28, 2026

Copy link
Copy Markdown
Contributor

💔 Test for 254d008 failed: CI. Failed job:

@rust-log-analyzer

This comment has been minimized.

@rust-cloud-vms
rust-cloud-vms Bot force-pushed the polonius-lazy-liveness-final branch 3 times, most recently from ef46fa3 to 29b9558 Compare August 28, 2026 15:52
@jackh726

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 Aug 28, 2026
Defer extra liveness calculation for Polonius Alpha
@rust-bors

rust-bors Bot commented Aug 28, 2026

Copy link
Copy Markdown
Contributor

☀️ Try build successful (CI)
Build commit: f904a04 (f904a046d815a8f17021ba39511de661f74c1612)
Base parent: 344f790 (344f7902949345394fa40a5d7dda31f012ccbc0d)

@rust-timer

This comment has been minimized.

@rust-timer

Copy link
Copy Markdown
Collaborator

Finished benchmarking commit (f904a04): 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 rustc-perf
@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.4% [0.3%, 0.5%] 11
Regressions ❌
(secondary)
1.2% [0.1%, 3.5%] 20
Improvements ✅
(primary)
-3.3% [-11.9%, -0.2%] 18
Improvements ✅
(secondary)
-4.5% [-11.6%, -0.1%] 19
All ❌✅ (primary) -1.9% [-11.9%, 0.5%] 29

Max RSS (memory usage)

Results (primary -2.0%, secondary 1.2%)

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.9% [0.8%, 9.2%] 16
Improvements ✅
(primary)
-2.0% [-2.0%, -2.0%] 1
Improvements ✅
(secondary)
-4.4% [-5.3%, -3.1%] 5
All ❌✅ (primary) -2.0% [-2.0%, -2.0%] 1

Cycles

Results (primary -3.6%, secondary -5.5%)

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)
4.6% [4.2%, 5.0%] 2
Improvements ✅
(primary)
-3.6% [-4.4%, -3.0%] 6
Improvements ✅
(secondary)
-6.9% [-19.1%, -2.3%] 14
All ❌✅ (primary) -3.6% [-4.4%, -3.0%] 6

Binary size

Results (secondary -0.0%)

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)
-0.0% [-0.0%, -0.0%] 4
All ❌✅ (primary) - - 0

Bootstrap: 475.673s -> 475.822s (0.03%)
Artifact size: 403.60 MiB -> 402.91 MiB (-0.17%)

@rustbot rustbot added perf-regression Performance regression. and removed S-waiting-on-perf Status: Waiting on a perf run to be completed. labels Aug 28, 2026
@rust-cloud-vms
rust-cloud-vms Bot force-pushed the polonius-lazy-liveness-final branch from 29b9558 to fead75b Compare September 1, 2026 17:12
@jackh726
jackh726 marked this pull request as ready for review September 1, 2026 17:13
@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Sep 1, 2026
@rust-cloud-vms
rust-cloud-vms Bot force-pushed the polonius-lazy-liveness-final branch 2 times, most recently from ea2196e to ba5a5f9 Compare September 18, 2026 21:41
@rust-bors

This comment has been minimized.

@rust-cloud-vms
rust-cloud-vms Bot force-pushed the polonius-lazy-liveness-final branch from ba5a5f9 to f2661e3 Compare September 19, 2026 15:42
@jackh726

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 Sep 19, 2026
@rust-bors

This comment has been minimized.

rust-bors Bot pushed a commit that referenced this pull request Sep 19, 2026
Defer extra liveness calculation for Polonius Alpha
@rust-bors

rust-bors Bot commented Sep 19, 2026

Copy link
Copy Markdown
Contributor

☀️ Try build successful (CI)
Build commit: 5c7880f (5c7880fc42042067782ea34311ccc9d8b517623a)
Base parent: feaadee (feaadeeaca7db0594da854e7c8c07495341c7439)

@rust-timer

This comment has been minimized.

@rust-timer

Copy link
Copy Markdown
Collaborator

Finished benchmarking commit (5c7880f): 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 rustc-perf
@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.2% [0.2%, 0.2%] 1
Regressions ❌
(secondary)
2.5% [2.3%, 2.7%] 6
Improvements ✅
(primary)
-1.6% [-4.5%, -0.1%] 31
Improvements ✅
(secondary)
-0.8% [-4.2%, -0.1%] 19
All ❌✅ (primary) -1.5% [-4.5%, 0.2%] 32

Max RSS (memory usage)

Results (primary 1.8%)

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

mean range count
Regressions ❌
(primary)
1.8% [1.8%, 1.8%] 1
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 1.8% [1.8%, 1.8%] 1

Cycles

Results (primary -2.7%, secondary -1.5%)

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.9% [2.9%, 2.9%] 1
Improvements ✅
(primary)
-2.7% [-2.7%, -2.7%] 1
Improvements ✅
(secondary)
-3.7% [-4.6%, -2.9%] 2
All ❌✅ (primary) -2.7% [-2.7%, -2.7%] 1

Binary size

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

Bootstrap: 502.551s -> 497.776s (-0.95%)
Artifact size: 406.86 MiB -> 408.96 MiB (0.52%)

@rustbot rustbot removed the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Sep 19, 2026
@rust-bors

This comment has been minimized.

@rust-cloud-vms
rust-cloud-vms Bot force-pushed the polonius-lazy-liveness-final branch from ee08c84 to 8540d04 Compare September 21, 2026 02:20
@jackh726

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 Sep 21, 2026
@rust-bors

This comment has been minimized.

rust-bors Bot pushed a commit that referenced this pull request Sep 21, 2026
Defer extra liveness calculation for Polonius Alpha
@rust-bors

rust-bors Bot commented Sep 21, 2026

Copy link
Copy Markdown
Contributor

☀️ Try build successful (CI)
Build commit: a51a48c (a51a48c6f77b69d10ec98590efd55f70e2d90fd9)
Base parent: d287eb7 (d287eb7a292caa8abbe12051dce2ee707fe03200)

@rust-timer

This comment has been minimized.

@rust-timer

Copy link
Copy Markdown
Collaborator

Finished benchmarking commit (a51a48c): 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 rustc-perf
@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)
1.9% [0.2%, 2.8%] 9
Improvements ✅
(primary)
-1.5% [-4.5%, -0.1%] 33
Improvements ✅
(secondary)
-1.2% [-4.2%, -0.2%] 10
All ❌✅ (primary) -1.5% [-4.5%, -0.1%] 33

Max RSS (memory usage)

Results (primary -0.4%)

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

mean range count
Regressions ❌
(primary)
4.9% [4.9%, 4.9%] 1
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
-3.1% [-3.5%, -2.7%] 2
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) -0.4% [-3.5%, 4.9%] 3

Cycles

Results (primary -2.1%, secondary 3.4%)

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

Binary size

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

Bootstrap: 503.997s -> 498.581s (-1.07%)
Artifact size: 408.93 MiB -> 409.02 MiB (0.02%)

@rustbot rustbot removed the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Sep 21, 2026
@lqd

lqd commented Sep 21, 2026

Copy link
Copy Markdown
Member

We were wondering about the perf results, since we split a handful of commits from this PR and landed them already:

In the last run there are also more primary improvements, less secondary improvements, less regressions (only 1, on the wg-grammar stress test, with a similar range on all runs), compared to the previous runs.

Overall this is looking good

  • ripgrep-nll on main is at 1.41, polonius here is at 1.45
  • clap-derive-nll on main is at 2.11, polonius here is at 2.27

And after this PR, we'll also have the next big change about computing multiple loans at a time rather per loan, so we're still on a good path to greatly reduce the overhead.

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-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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants