3 ms·
Creating a new V8 Context when V8 is compiled with snapshots is ~2 ms on a decent hardware. But it's still too long for node.js needs: the idea was to create an
by mraleph 15y ago
Creating a new V8 Context when V8 is compiled with snapshots is ~2 ms on a decent hardware. But it's still too long for node.js needs: the idea was to create an isolated world per request.
Yes, you can spawn a context faster if you strip out the duplication and make Contexts share built-in objects. But then you remove the only important feature Contexts have --- isolation and you don't really need them.
[Another important thing here: in the browser each iframe has a different Context. You can't really abandon isolation --- that would lead to spec violation and massive security holes]