nodejs / node

Node.js JavaScript runtime ✨🐢🚀✨
https://nodejs.org
Other
106.65k stars 29.08k forks source link

Node-API V8 Fast API #54731

Open ronag opened 2 weeks ago

ronag commented 2 weeks ago

What is the problem this feature will solve?

Node-API methods could be faster in certain cases

What is the feature you are proposing to solve the problem?

Somehow add support for V8 Fast API.

What alternatives have you considered?

No response

bnoordhuis commented 2 weeks ago

Multi-engine support is still a design constraint for napi, as far as I'm aware, so I don't see how that could possibly work - V8's fast API is incredibly V8-centric.

ronag commented 2 weeks ago

Similar to V8 we could create a constrained mode in Node-API that in V8 case could be implemented with fast api and in other engines would just fallback to normal implementation.

vmoroz commented 1 week ago

We have discussed adding the new API that adds the V8 Fast API support in Node-API team meeting. It must be a great addition as long as it can fall back to the normal API for other JS engines. I would like to create a draft implementation as a proof of concept. Since I am also working on the Node-API implementation for the Hermes engine, it would be interesting to see if it can be applied there.