Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use Vec extend instead of repeated pushes on several places #91042

Merged
merged 1 commit into from
Dec 9, 2021

Conversation

Kobzol
Copy link
Contributor

@Kobzol Kobzol commented Nov 19, 2021

Inspired by #90813, I tried to use a simple regex (for .*in.*\{\n.*push\(.*\);\n\s+}) to search for more places that would use Vec::push in a loop and replace them with Vec::extend.

These probably won't have as much perf. impact as the original PR (if any), but it would probably be better to do a perf run to see if there are not any regressions.

@rust-highfive
Copy link
Collaborator

r? @nagisa

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

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Nov 19, 2021
@jyn514
Copy link
Member

jyn514 commented Nov 19, 2021

@bors try @rust-timer queue

@rust-timer
Copy link
Collaborator

Awaiting bors try build completion.

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

@rustbot rustbot added the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Nov 19, 2021
@bors
Copy link
Contributor

bors commented Nov 19, 2021

⌛ Trying commit ad94a04fa16f53a0ac69983b8e7d6bf9640453a1 with merge 76d592791c8d5353c733921c2564ffb0b6b2ed3b...

@jyn514 jyn514 added I-compiletime Issue: Problems and improvements with respect to compile times. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. and removed S-waiting-on-perf Status: Waiting on a perf run to be completed. labels Nov 19, 2021
@rust-log-analyzer

This comment has been minimized.

@nagisa
Copy link
Member

nagisa commented Nov 19, 2021

@bors try @rust-timer queue

@rust-timer
Copy link
Collaborator

Awaiting bors try build completion.

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

@rustbot rustbot added the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Nov 19, 2021
@bors
Copy link
Contributor

bors commented Nov 19, 2021

⌛ Trying commit 3e9d1b944e9b6d599415446bf0ffc3dfe1e32718 with merge 826bfd4f40a8dcd4947f74103178fb991029a322...

@bors
Copy link
Contributor

bors commented Nov 20, 2021

☀️ Try build successful - checks-actions
Build commit: 826bfd4f40a8dcd4947f74103178fb991029a322 (826bfd4f40a8dcd4947f74103178fb991029a322)

@rust-timer
Copy link
Collaborator

Queued 826bfd4f40a8dcd4947f74103178fb991029a322 with parent a77da2d, future comparison URL.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (826bfd4f40a8dcd4947f74103178fb991029a322): comparison url.

Summary: This change led to very large relevant regressions 😿 in compiler performance.

  • Very large regression in instruction counts (up to 5.3% on incr-unchanged builds of inflate)

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

@rustbot rustbot added perf-regression Performance regression. and removed S-waiting-on-perf Status: Waiting on a perf run to be completed. labels Nov 20, 2021
@Kobzol
Copy link
Contributor Author

Kobzol commented Nov 20, 2021

Hmm, I could investigate the regression, but since it seems that there are no big improvements either, I wonder if it's worth it to do these changes at all?

@jyn514
Copy link
Member

jyn514 commented Nov 20, 2021

@Kobzol FYI perf has been very unreliable lately, so this doesn't necessarily mean your change is slower. There's a Zulip thread about it somewhere.

@nagisa
Copy link
Member

nagisa commented Dec 8, 2021

r=me once the conflicts are resolved.

@nagisa nagisa removed the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Dec 8, 2021
@nagisa nagisa added the S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. label Dec 8, 2021
@Kobzol
Copy link
Contributor Author

Kobzol commented Dec 8, 2021

@nagisa I kept only the less controversial changes and rebased. (I don't have permissions to r=you though I suppose)

@nagisa
Copy link
Member

nagisa commented Dec 8, 2021

@bors r+ rollup

Thanks!

@bors
Copy link
Contributor

bors commented Dec 8, 2021

📌 Commit 883d0a7 has been approved by nagisa

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Dec 8, 2021
bors added a commit to rust-lang-ci/rust that referenced this pull request Dec 9, 2021
…askrgr

Rollup of 5 pull requests

Successful merges:

 - rust-lang#91042 (Use Vec extend instead of repeated pushes on several places)
 - rust-lang#91476 (Improve 'cannot contain emoji' error.)
 - rust-lang#91568 (Pretty print break and continue without redundant space)
 - rust-lang#91645 (Implement `core::future::join!`)
 - rust-lang#91666 (update Miri)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Dec 9, 2021
Use Vec extend instead of repeated pushes on several places

Inspired by rust-lang#90813, I tried to use a simple regex (`for .*in.*\{\n.*push\(.*\);\n\s+}`) to search for more places that would use `Vec::push` in a loop and replace them with `Vec::extend`.

These probably won't have as much perf. impact as the original PR (if any), but it would probably be better to do a perf run to see if there are not any regressions.
@bors bors merged commit 793648a into rust-lang:master Dec 9, 2021
bors added a commit to rust-lang-ci/rust that referenced this pull request Dec 9, 2021
…askrgr

Rollup of 6 pull requests

Successful merges:

 - rust-lang#87599 (Implement concat_bytes!)
 - rust-lang#89999 (Update std::env::temp_dir to use GetTempPath2 on Windows when available.)
 - rust-lang#90796 (Remove the reg_thumb register class for asm! on ARM)
 - rust-lang#91042 (Use Vec extend instead of repeated pushes on several places)
 - rust-lang#91634 (Do not attempt to suggest help for overly malformed struct/function call)
 - rust-lang#91685 (Install llvm tools to sysroot when assembling local toolchain)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
@rustbot rustbot added this to the 1.59.0 milestone Dec 9, 2021
@Kobzol Kobzol deleted the vec-extend-cleanup branch December 9, 2021 07:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
I-compiletime Issue: Problems and improvements with respect to compile times. perf-regression Performance regression. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. 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.

9 participants