Node-API performance
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 122k
- Forks
- 37.3k
- Avg merge
- 4d 2h
- Merged PRs (30d)
- 283
Description
What is the problem this feature will solve?
Improve performance when creating large V8 objects which is critical since these must always be created on the main thread, blocking the event loop.
Currently, the overhead of each method is very significant - especially for the primitive operations such as simply setting a property.
As a very typical example of the current problem, you can consider these two methods for setting a property on an object:
napi_status napi_set_property(napi_env env,
napi_value object,
napi_value key,
napi_value value);
napi_status napi_set_named_property(napi_env env,
napi_value object,
const char* utf8name,
napi_value value);
Naively, one expects that using the first one will be faster when the key is already UTF-16. However calling this method requires to first call napi_create_string_utf16 and the combined overhead of the two calls offsets the single call of the second method when the key is not very long (which is usually the case).
What is the feature you are proposing to solve the problem?
Step 1: (not needed, see below)napi_set_named_property that takes UTF-16
Step 2: Methods that can create in one call a whole array/object from a C data structure - especially ones for strings already encoded in UTF-16
What alternatives have you considered?
No response
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the Node-API entry points napi_set_property, napi_set_named_property, and napi_create_string_utf16, then examine how large V8 objects and primitive property operations are created on the main thread. The issue does not name files or tests; done would require a defined API scope for bulk C-data-based array/object creation and evidence that the proposed operations reduce creation overhead.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp, javascript, node.js
- Domain
- api, backend
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Quiet
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100