Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Investigate using Node 5.7.0's cachedData support #594

Closed
novemberborn opened this issue Mar 2, 2016 · 1 comment
Closed

Investigate using Node 5.7.0's cachedData support #594

novemberborn opened this issue Mar 2, 2016 · 1 comment
Assignees
Labels
future we'll get back to this eventually help wanted performance question

Comments

@novemberborn
Copy link
Member

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.

See API docs. Background in nodejs/node#4777.

@novemberborn
Copy link
Member Author

http://v8project.blogspot.co.uk/2015/07/code-caching.html provides a explanation of this feature:

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.js and 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
future we'll get back to this eventually help wanted performance question
Projects
None yet
Development

No branches or pull requests

1 participant