3 ms·
Shared memory & low overhead sharing of expensive objects is probably the primary reason to use Napa
by nevir 9y ago
Shared memory & low overhead sharing of expensive objects is probably the primary reason to use Napa
- MuffinFlavored 9y agoI don't think Napa features shared memory though, does it?
- daiyip 9y agoSince everything is in a single process, they can be shared via native structures. Each JS thread has its own heap, there will be a cost to transfer the shared native structures into JS object. For complex objects, usually JSON is used thus marshall/unmarshall is needed. But for objects like UTF-8 string or ArrayBuffer, the same layout is used across JS and C++, thus at almost no cost. Another thing is that between addon-modules, they can pass pointer of native structures (like Buffer) using 2 uint32 through JS. In this case, JS works as a binding language.