3 ms·
why down vote ? fork is fine as long as the communication between the two processes is low-bandwidth.
by je42 9y ago
why down vote ? fork is fine as long as the communication between the two processes is low-bandwidth.
- Touche 9y agoIt works fine for many use cases but has serialization overhead.
- nevir 9y agoShared 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.