Skip to content
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

Merged

Conversation

overlookmotel
Copy link
Collaborator

@overlookmotel overlookmotel commented Nov 17, 2024

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.

Copy link

graphite-app bot commented Nov 17, 2024

Your org has enabled the Graphite merge queue for merging into main

Add 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.

@github-actions github-actions bot added A-minifier Area - Minifier A-ast Area - AST A-transformer Area - Transformer / Transpiler A-isolated-declarations Isolated Declarations labels Nov 17, 2024
@github-actions github-actions bot added the C-enhancement Category - New feature or request label Nov 17, 2024
Copy link

codspeed-hq bot commented Nov 17, 2024

CodSpeed Performance Report

Merging #7331 will not alter performance

Comparing 11-17-feat_allocator_introduce_vec_from_array_in_ (39afb48) with main (1938a1d)

Summary

✅ 30 untouched benchmarks

@overlookmotel overlookmotel marked this pull request as ready for review November 17, 2024 18:50
@overlookmotel overlookmotel force-pushed the 11-17-feat_allocator_introduce_vec_from_array_in_ branch 2 times, most recently from 047c30d to f34b427 Compare November 17, 2024 19:44
@graphite-app graphite-app bot added the 0-merge Merge with Graphite Merge Queue label Nov 18, 2024
Copy link

graphite-app bot commented Nov 18, 2024

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.
@Boshen Boshen force-pushed the 11-17-feat_allocator_introduce_vec_from_array_in_ branch from f34b427 to 39afb48 Compare November 18, 2024 02:35
Boshen pushed a commit that referenced this pull request Nov 18, 2024
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.
@graphite-app graphite-app bot merged commit 39afb48 into main Nov 18, 2024
27 checks passed
@graphite-app graphite-app bot deleted the 11-17-feat_allocator_introduce_vec_from_array_in_ branch November 18, 2024 02:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
0-merge Merge with Graphite Merge Queue A-ast Area - AST A-isolated-declarations Isolated Declarations A-minifier Area - Minifier A-transformer Area - Transformer / Transpiler C-enhancement Category - New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant