You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Node 5.7.0 adds produceCachedData and cachedData options to new vm.Script(). We might be able to produce cached data for the child process bootstrap code (including custom require hooks) and use that to improve startup time for each fork.
V8 uses just-in-time compilation (JIT) to execute Javascript code. This means that immediately prior to running a script, it has to be parsed and compiled - which can cause considerable overhead. (…) code caching is a technique that lessens this overhead. (…)
When a script is compiled by V8, cache data can be produced to speed up later compilations (…) During later compilations, the previously produced cache data can be attached to the source object (…). This time, code will be produced much faster, as V8 bypasses compiling the code and deserializes it from the provided cache data.
However only the source passed to vm.Script() can be cached. To make most use of this feature I think we'd have to combine test-worker.jsand it's dependencies into a single source string. We'd have to properly instantiate modules and populate the require cache when the combined source is evaluated.
If we ever get to that point we'll already have a fair amount of performance gain anyway just because there'll less disk access, though it'll be interesting to see to what extend caching the compilation data can help.
Node 5.7.0 adds
produceCachedData
andcachedData
options tonew vm.Script()
. We might be able to produce cached data for the child process bootstrap code (including custom require hooks) and use that to improve startup time for each fork.See API docs. Background in nodejs/node#4777.
The text was updated successfully, but these errors were encountered: