Node-API performance
Nadie ha tomado este issue todavía.
- Lenguaje dominante
- JavaScript
- Estrellas
- 122k
- Forks
- 37.3k
- Merge medio
- 4 d 2 h
- PR fusionados (30 d)
- 283
Descripción
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
Guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Línea de trabajo
Comienza con los puntos de entrada de Node-API napi_set_property, napi_set_named_property y napi_create_string_utf16; después, examina cómo se crean objetos V8 grandes y operaciones de propiedades primitivas en el hilo principal. El issue no nombra archivos ni pruebas; para darlo por terminado se necesitaría un alcance de API definido para la creación masiva de arrays/objetos basados en datos C, así como evidencia de que las operaciones propuestas reducen la sobrecarga de creación.
Escrito por el modelo de indexación a partir del texto del issue.
Evaluación
- Stack tecnológico
- cpp, javascript, node.js
- Área
- api, backend
- Tipo de issue
- Nueva funcionalidad
- Dificultad
- 5/5
- Tiempo estimado
- Más de una semana
- Estado de actividad
- Tranquilo
- Claridad
- Necesita aclaración
- Aptitud para principiantes
- 35/100