-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
Make TypedArena::alloc_from_iter
like DroplessArena::alloc_from_iter
.
#116327
Conversation
…er`. `TypedArena` and `DroplessArena` both have an `alloc_from_impl` function, but they are implemented in completely different ways. - `TypedArena` uses the `IterExt` trait, which by default (a) collects the iterator's elements into a temporary `SmallVec`, (b) allocates memory, and (c) bulk-copies (and consumes) the elements into the arena memory. There are also specializations for `array::IntoIter`/`Vec`/`SmallVec` that avoid copying into a temporary `SmallVec`. - `DroplessArena` has two ways of doing it: - For known-sized iterators, it allocates memory and then copies items in one at a time. - Otherwise, it works much like the default case for `TypedArena`, collecting into a temporary `SmallVec` and then bulk-copying. Performance-wise, they are very similar. `DroplessArena` is a little more general, because it automatically works with any known-sized iterator type, while `TypedArena`'s approach requires specialization on a per-type basis. This commit removes `IterExt` and moves `DroplessArena::{write,alloc}_from_iter` so they can be used from `TypedArena`. This reduces the amount of code in this file.
I'm not expecting any performance changes. @bors try @rust-timer queue cc @Zoxc |
This comment has been minimized.
This comment has been minimized.
Make `TypedArena::alloc_from_iter` like `DroplessArena::alloc_from_iter`. Although they do similar things, they are currently implemented differently, for no particular reason. r? `@cjgillot`
They can't use the same code as the allocated slice is not initialized when You could look into reverting #78569 if you want this to be cleaner. |
☀️ Try build successful - checks-actions |
This comment has been minimized.
This comment has been minimized.
Are you sure? |
Finished benchmarking commit (9f6a230): comparison URL. Overall result: ❌✅ regressions and improvements - ACTION NEEDEDBenchmarking 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 may lead to changes in compiler perf. Next Steps: If you can justify the regressions found in this try perf run, please indicate this with @bors rollup=never Instruction countThis is a highly reliable metric that was used to determine the overall result at the top of this comment.
Max RSS (memory usage)ResultsThis is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.
CyclesThis benchmark run did not return any relevant results for this metric. Binary sizeThis benchmark run did not return any relevant results for this metric. Bootstrap: 626.835s -> 626.335s (-0.08%) |
The |
See #116370 for a better approach. |
Although they do similar things, they are currently implemented differently, for no particular reason.
r? @cjgillot