-
Notifications
You must be signed in to change notification settings - Fork 13.4k
Use Vec extend and collect instead of repeatedly calling push #90813
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Conversation
(rust-highfive has picked a reviewer for you, use r? to override) |
bd28d5e
to
a82692d
Compare
Nice! Since it'll very likely impact performance, I'll prevent putting it into a rollup. @bors: r+ rollup=iffy |
📌 Commit a82692d has been approved by |
…uillaumeGomez Use Vec extend and collect instead of repeatedly calling push
☀️ Test successful - checks-actions |
Finished benchmarking commit (f31622a): comparison url. Summary: This change led to very large relevant improvements 🎉 in compiler performance.
If you disagree with this performance assessment, please file an issue in rust-lang/rustc-perf. @rustbot label: -perf-regression |
Wow, that's much better than what I expected! |
That’s the magic of the TrustedLen trait 😉 |
Wow, that is really impressive! |
Just a note: it's better to use rollup=never if a PR will very likely affect perf. Otherwise, you can't tell what the perf changes were, and it may mask perf regressions in other rolled-up PRs. |
|
If for some reason, someone really needed to put it into a rollup, they could just mark the PR as rollup-able. In my experience, But it's not a big deal; it just makes perf tracking easier. |
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.
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.
10484: internal: Update match checking algorithm r=lnicola a=iDawer Sync match checking algorithm with rust-lang/rust f31622a50 2021-11-12 (rust-lang/rust#90813) This update brings huge simplification to the match checking and introduces an easy to use machinery for pattern destructuring and also: 1. Add a function to do post-inference normalization `hir_ty::infer::normalize(...)`. 2. Store binding modes in `InferenceResult`. Todo: - [x] Rebase & test (#10484 (comment)) Co-authored-by: Dawer <7803845+iDawer@users.noreply.github.com> Co-authored-by: iDawer <ilnur.iskhakov.oss@outlook.com>
No description provided.