-
-
Notifications
You must be signed in to change notification settings - Fork 454
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
feat(allocator): introduce Vec::from_array_in
#7331
feat(allocator): introduce Vec::from_array_in
#7331
Conversation
Your org has enabled the Graphite merge queue for merging into mainAdd the label “0-merge” to the PR and Graphite will automatically add it to the merge queue when it’s ready to merge. Or use the label “hotfix” to add to the merge queue as a hot fix. You must have a Graphite account and log in to Graphite in order to use the merge queue. Sign up using this link. |
CodSpeed Performance ReportMerging #7331 will not alter performanceComparing Summary
|
047c30d
to
f34b427
Compare
Merge activity
|
Because we lack specialization in stable Rust, `Vec::from_iter_in` is unable to take advantage of the fact that `[T; N]` has a statically knowable size. Introduce `Vec::from_array_in` for this case, which should be able to create the `Vec` with a single static-sized memcpy, or may allow the compiler to see that it can construct the array directly in the arena, rather than construct on stack and then copy to the arena. Also add a corresponding `AstBuilder::vec_from_array` method, and use it in various places in codebase.
f34b427
to
39afb48
Compare
Use `AstBuilder::vec_from_array` introduced in #7331 in the transformer, in place of creating a `Vec` with `Vec::with_capacity` and then pushing values to it.
Because we lack specialization in stable Rust,
Vec::from_iter_in
is unable to take advantage of the fact that[T; N]
has a statically knowable size.Introduce
Vec::from_array_in
for this case, which should be able to create theVec
with a single static-sized memcpy, or may allow the compiler to see that it can construct the array directly in the arena, rather than construct on stack and then copy to the arena.Also add a corresponding
AstBuilder::vec_from_array
method, and use it in various places in codebase.