josephg / node-foundationdb

Modern Node.js FoundationDB bindings
Other
116 stars 17 forks source link

Move to napi #13

Closed josephg closed 5 years ago

josephg commented 6 years ago

N-API is the new hotness amongst native javascript module bindings. We should port the native code to run on that instead of compile against v8 directly. N-api means we can make a single compiled artifact for each platform instead of one artifact per node version / per platform.

josephg commented 5 years ago

Status:

I’m sitting on this issue because node 8 is still actively used. Moving to n-api will probably require a minimum of either node 10 or node 11 (for threaded function support). So long as node 8 is still a LTS release, I’d like to maintain compatibility.

I’ve also had a good look through how we’re using uv_async_send and it looks like the code at the moment is extremely inefficient. Overall throughput should rise substantially once we move to napi.

josephg commented 5 years ago

Node 8 drops LTS support in December. In the meantime, nan doesn't yet support node 12.

So at the time of writing, using nan allows support for node versions 8-11. Using n-api will support node versions 10-12. It looks like node 8 is still the king of usage, so the code as it is right now is the most compatible. I think for now a n-api version will have to live in a branch until node 8 stops being so popular. (Or December rolls around.)

Its probably still worth making that branch though.

josephg commented 5 years ago

Actually this is no longer true. N-API has been backported all the way back to node 6. Starting this now.

josephg commented 5 years ago

This has landed via the napi directory.