Reserve items in Extend implementations - #162495
Conversation
|
@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.
Reserve items in `Extend` implementation of `MonoItems`
|
Searched in the compiler for more places to do this |
This comment has been minimized.
This comment has been minimized.
Reserve items in `Extend` implementation of `MonoItems`
Extend implementation of MonoItemsExtend implementations
This comment has been minimized.
This comment has been minimized.
|
Nice finds! Just noting that in case the data structure was previously cleared or its size reduced, this might overallocate. The exact size to allocate should be something like items.len() - (self.capacity() - self.len()). |
|
Per the documentation of https://doc.rust-lang.org/stable/std/vec/struct.Vec.html#method.reserve So given that, I don't think you're right |
|
Finished benchmarking commit (5653ff1): comparison URL. Overall result: ✅ improvements - no action neededBenchmarking means the PR may be perf-sensitive. Consider adding rollup=never if this change is not fit for rolling up. @rustbot label: -S-waiting-on-perf -perf-regression 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 0.4%)A less reliable metric. May be of interest, but not used to determine the overall result above.
CyclesResults (primary 0.2%, secondary -3.7%)A less reliable metric. May be of interest, but not used to determine the overall result above.
Binary sizeResults (primary -0.0%, secondary -0.0%)A less reliable metric. May be of interest, but not used to determine the overall result above.
Bootstrap: 477.178s -> 480.938s (0.79%) |
|
r? @wesleywiser rustbot has assigned @wesleywiser. Use Why was this reviewer chosen?The reviewer was selected based on:
|
|
The |
|
Ah, sorry, I got this wrong again 😆Yeah, looks generally reasonable. Thanks! @bors r+ |
|
r? kobzol |
…uwer Rollup of 9 pull requests Successful merges: - #157738 (Support move expressions in coroutine closures) - #160219 (Implement `Thread::os_id`) - #162449 (Prefer removing a redundant shared reference over reborrow) - #162494 (Ignore `self-in-const-generics` test for parallel frontend) - #162495 (Reserve items in `Extend` implementations) - #162238 (trait solver: Include implied outlives assumptions) - #162473 (Small `x perf` improvements) - #162489 (Clean up on upvar_tys) - #162500 (Move the `expect-item-after-attribute.rs` test to the correct directory)
This might be a perf win, inspired by @Kobzol's approach in this PR: #162480