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

perf: Performance improvements for Node-API backend #815

Merged
merged 2 commits into from
Nov 12, 2021

Conversation

kjvalencik
Copy link
Member

@kjvalencik kjvalencik commented Oct 28, 2021

Switching to raw::InheritedScope is the more significant improvement. The argv change is more minor.

tl;dr -- We were always creating handle scopes on function calls, but Node-API has already done it for us. It's only necessary to create a scope for execute_scoped and compute_scoped.

Node-API creates handle scopes as part of the environment. Creating an explicit scope is only necessary for `Context::compute_scoped` and `Context::execute_scoped`.
Additionally, avoids initialization of allocated space
Copy link
Collaborator

@dherman dherman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! The TODO comment gave me one idea for a maintenance practice, see what you think.

@@ -61,6 +96,7 @@ pub unsafe fn data(env: Env, info: FunctionCallbackInfo, out: &mut *mut c_void)
}

/// Gets the number of arguments passed to the function.
// TODO: Remove this when `CallContext` is refactored to get call info upfront.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Idea: would it be useful to label TODO comments with labels for the future trigger that will allow the action to be taken, e.g. TODO(remove-legacy)?

@kjvalencik kjvalencik merged commit e50964a into main Nov 12, 2021
@kjvalencik kjvalencik deleted the kv/easy-perf-wins branch November 12, 2021 15:12
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