Node-API performance
Nessuno ha ancora preso questa issue.
- Lingua principale
- JavaScript
- Stelle
- 122k
- Fork
- 37.3k
- Merge medio
- 4g 2h
- PR unite (30g)
- 283
Descrizione
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
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Direzione di ricerca
Inizia dagli entry point di Node-API napi_set_property, napi_set_named_property e napi_create_string_utf16, quindi esamina come vengono creati oggetti V8 di grandi dimensioni e operazioni su proprietà primitive nel thread principale. L’issue non indica file o test; per considerarla completata sarebbero necessari un ambito API definito per la creazione in blocco di array/oggetti basati su dati C e prove che le operazioni proposte riducano l’overhead di creazione.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- cpp, javascript, node.js
- Ambito
- api, backend
- Tipo di issue
- Funzionalità
- Difficoltà
- 5/5
- Tempo stimato
- Più di una settimana
- Stato di attività
- Tranquilla
- Chiarezza
- Da chiarire
- Idoneità per principianti
- 35/100