Skip to content

perf(napi): optimize Vec allocation in FromNapiValue implementation for Vec<T>#2793

Merged
Brooooooklyn merged 2 commits intonapi-rs:mainfrom
SyMind:perf-array-with_capacity
Jul 22, 2025
Merged

perf(napi): optimize Vec allocation in FromNapiValue implementation for Vec<T>#2793
Brooooooklyn merged 2 commits intonapi-rs:mainfrom
SyMind:perf-array-with_capacity

Conversation

@SyMind
Copy link
Contributor

@SyMind SyMind commented Jul 22, 2025

This PR improves the performance of converting JavaScript arrays to Rust Vec by pre-allocating the vector with the known capacity.

@graphite-app
Copy link

graphite-app bot commented Jul 22, 2025

How to use the Graphite Merge Queue

Add the label ready-to-merge to this PR to add it to the merge queue.

You must have a Graphite account in order to use the merge queue. Sign up using this link.

An organization admin has enabled the Graphite Merge Queue in this repository.

Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue.

@SyMind SyMind changed the title perf: use Vec with_capacity in FromNapiValue perf: optimize Vec allocation in FromNapiValue implementation for Vec<T> Jul 22, 2025
@Brooooooklyn Brooooooklyn changed the title perf: optimize Vec allocation in FromNapiValue implementation for Vec<T> perf(napi): optimize Vec allocation in FromNapiValue implementation for Vec<T> Jul 22, 2025
@Brooooooklyn Brooooooklyn merged commit a2ade0d into napi-rs:main Jul 22, 2025
64 checks passed
@github-actions github-actions bot mentioned this pull request Jul 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants