0

Improve capacity estimation in Vec::from_iter by AngelicosPhosphoros · Pull Requ...

 2 years ago
source link: https://github.com/rust-lang/rust/pull/92138
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

Conversation

Copy link

Contributor

AngelicosPhosphoros commented on Dec 20, 2021

edited by Mark-Simulacrum

Iterates on the attempt made in #53086.

Closes #48994

Copy link

Collaborator

rust-highfive commented on Dec 20, 2021

r? @kennytm

(rust-highfive has picked a reviewer for you, use r? to override)

Copy link

Contributor

Author

AngelicosPhosphoros commented on Dec 20, 2021

Could someone kindly start perf after tests, please?

Copy link

Collaborator

rust-timer commented on Dec 20, 2021

Awaiting bors try build completion.

@rustbot label: +S-waiting-on-perf

Copy link

Contributor

bors commented on Dec 20, 2021

hourglass Trying commit a4c2147 with merge d9b995d...

Copy link

Contributor

bors commented on Dec 20, 2021

sunny Try build successful - checks-actions
Build commit: d9b995d (d9b995d978da72c2e7147d41e7c4a4a8369ef452)

Copy link

Collaborator

rust-timer commented on Dec 20, 2021

Copy link

Collaborator

rust-timer commented on Dec 21, 2021

Finished benchmarking commit (d9b995d): comparison url.

Summary: This change led to moderate relevant improvements tada in compiler performance.

  • Moderate improvement in instruction counts (up to -2.5% on incr-patched: println builds of regression-31157)

If you disagree with this performance assessment, please file an issue in rust-lang/rustc-perf.

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 led to changes in compiler perf.

@bors rollup=never
@rustbot label: +S-waiting-on-review -S-waiting-on-perf -perf-regression

Copy link

Contributor

Author

AngelicosPhosphoros commented on Dec 21, 2021

I updated PR.
I hope, this guesses are better.

May someone start perf again?

Copy link

Collaborator

rust-timer commented on Dec 21, 2021

Awaiting bors try build completion.

@rustbot label: +S-waiting-on-perf

Copy link

Contributor

bors commented on Dec 21, 2021

hourglass Trying commit ee6b70e with merge 295c663...

Copy link

Contributor

bors commented on Dec 21, 2021

sunny Try build successful - checks-actions
Build commit: 295c663 (295c663aa9e8675abae1f4c4781b0e4d1a10b930)

Copy link

Collaborator

rust-timer commented on Dec 21, 2021

Copy link

Collaborator

rust-timer commented on Dec 21, 2021

Finished benchmarking commit (295c663): comparison url.

Summary: This change led to large relevant mixed results shrug in compiler performance.

  • Large improvement in instruction counts (up to -2.3% on full builds of issue-46449)
  • Small regression in instruction counts (up to 2.2% on incr-patched: println builds of regression-31157)

If you disagree with this performance assessment, please file an issue in rust-lang/rustc-perf.

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 led 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-review -S-waiting-on-perf +perf-regression

Copy link

Contributor

Author

AngelicosPhosphoros commented on Dec 21, 2021

I am curious, how my PR with added code can lower instruction count? What instruction count means?

Copy link

Contributor

Kobzol commented on Dec 21, 2021

Instruction count here means how many instructions were actually executed when compiling a specific crate with specific settings (incremental/non-incremental, check/debug/opt etc.). Lower instruction count usually means faster compile times, so this is actually a good thing!

Since your change only modifies library code, the results seem to hint that it indeed sped up Vec collection, which could translate to nice speedups not only for Rustc compile times, but also for the runtime of all Rust programs!

Copy link

Contributor

Author

AngelicosPhosphoros commented on Dec 21, 2021

Oh, that's nice.

However, I wonder why walltime for match-stress-exhaustive_patterns opt increased by 7.46% link.

Also bootstrap times increased too (maybe because there are a lot of code which collects to Vec and I increased amount of code to instantiate in each case?).

Copy link

Contributor

Kobzol commented on Dec 21, 2021

Bootstrap is a bit noisy, unless it regresses for +10% or something, it should be fine I think. Wall times are also extremely noisy in general, this one incr-unchanged looks like noise.

Copy link

Collaborator

rust-timer commented 12 days ago

Awaiting bors try build completion.

@rustbot label: +S-waiting-on-perf

Copy link

Contributor

bors commented 12 days ago

hourglass Trying commit 647ac35 with merge d499522...

Copy link

Contributor

bors commented 12 days ago

sunny Try build successful - checks-actions
Build commit: d499522 (d499522b3e906fe5c31337590db9d0564b717e42)

Copy link

Collaborator

rust-timer commented 12 days ago

Copy link

Collaborator

rust-timer commented 12 days ago

Finished benchmarking commit (d499522): comparison url.

Summary: This change led to large relevant improvements tada in compiler performance.

  • Large improvement in instruction counts (up to -2.9% on full builds of issue-46449 doc)

If you disagree with this performance assessment, please file an issue in rust-lang/rustc-perf.

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 led to changes in compiler perf.

@bors rollup=never
@rustbot label: +S-waiting-on-review -S-waiting-on-perf -perf-regression

If you could summarize the perf results across the runs so that we can make an informed decision as to which variant to use, that would be good.

Copy link

Contributor

Author

AngelicosPhosphoros commented 11 days ago

It seems that last results are best. They don't have any regressions unlike first perf and have better improves than second one.

Mark-Simulacrum

changed the title Try to make some guesses about capacity in Vec::from_iter

Improve capacity estimation in Vec::from_iter

11 days ago

@bors r+

Thanks -- squashed the commits and approving.

Copy link

Contributor

bors commented 10 days ago

pushpin Commit ea570c6 has been approved by Mark-Simulacrum

Copy link

Contributor

bors commented 10 days ago

hourglass Testing commit ea570c6 with merge 74fbbef...

Copy link

Contributor

bors commented 10 days ago

sunny Test successful - checks-actions
Approved by: Mark-Simulacrum
Pushing 74fbbef to master...

bors

merged commit 74fbbef into

rust-lang:master 10 days ago

11 checks passed

rustbot

added this to the 1.60.0 milestone

10 days ago

Copy link

Collaborator

rust-timer commented 9 days ago

Finished benchmarking commit (74fbbef): comparison url.

Summary: This change led to large relevant improvements tada in compiler performance.

  • Large improvement in instruction counts (up to -3.0% on full builds of projection-caching doc)

If you disagree with this performance assessment, please file an issue in rust-lang/rustc-perf.

@rustbot label: -perf-regression

AngelicosPhosphoros

deleted the try_smarter_vec_from_iter_48994_2 branch

9 days ago

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK