Use try_fold in Vec::extend_desugared#156440
Conversation
|
rustbot has assigned @Mark-Simulacrum. Use Why was this reviewer chosen?The reviewer was selected based on:
|
|
Tested locally: |
|
Vec code is very hot and highly responsive to perturbations, let's see what perf says @bors try @rust-timer queue |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Use `try_fold` in `Vec::extend_desugared`
This comment has been minimized.
This comment has been minimized.
|
Error occured while categorizing benchmark run:
|
|
@rust-timer queue |
This comment has been minimized.
This comment has been minimized.
|
@rust-timer build dc931d4 |
|
Failed to enqueue some commit SHAs. Maybe they were already benchmarked? |
|
Scratch that. Let's start over. @bors try @rust-timer queue |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Use `try_fold` in `Vec::extend_desugared`
This comment has been minimized.
This comment has been minimized.
|
Finished benchmarking commit (8902743): 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 @bors rollup=never Instruction countOur most reliable metric. Used to determine the overall result above. However, even this metric can be noisy.
Max RSS (memory usage)Results (primary 2.8%, secondary -2.5%)A less reliable metric. May be of interest, but not used to determine the overall result above.
CyclesResults (primary 16.7%, secondary 3.7%)A less reliable metric. May be of interest, but not used to determine the overall result above.
Binary sizeResults (primary 1.2%, secondary 0.6%)A less reliable metric. May be of interest, but not used to determine the overall result above.
Bootstrap: 507.838s -> 524.419s (3.27%) |
Try to revive #68046.
Resolves #63340.
Vec::extend_desugaredis the fallback path forcollect&extendfrom non-TrustedLeniterators. It previously usedwhile let Some(element) = iterator.next(), which makes adapters likeChainto execute extra code on every call tonext().This PR switches to
try_fold, which lets adapters use their specialized fold implementations, avoiding overhead.