-
Notifications
You must be signed in to change notification settings - Fork 285
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
Remove wasteful allocation in neon_runtime::napi::call::get
#530
Comments
#2 to seems like a possible option. Drop the I'm not sure how many touch points are implicitly converting to that type or transmuting to it. |
Taking another look:
Given the limited scope of these changes and that all calls are abstracted by |
As of #507, getting a specific argument
N
in a function call internally creates a temporary Vec that N-API can store the arguments up to and includigN
. It's done this way becausenapi_get_cb_info
doesn't let you get a particular argument, but only a list of the arguments.The end result is that code like:
There could be several ways to improve this:
[napi_value; 10]
, and only use a dynamicVec<>
when a higherN
is requested. This avoids the allocations in the common case which are (probably) the most expensive.Vec<>
once, and store it in the FunctionCallbackInfo on the Rust side. This might be a bit harder but it would eliminate the waste entirely in the N-API runtime.The text was updated successfully, but these errors were encountered: