-
-
Notifications
You must be signed in to change notification settings - Fork 35.3k
Slow creation of vm contexts in Node 8 #14229
Copy link
Copy link
Closed
Labels
duplicateIssues and PRs that are duplicates of other issues or PRs.Issues and PRs that are duplicates of other issues or PRs.v8 engineIssues and PRs related to the V8 dependency.Issues and PRs related to the V8 dependency.vmIssues and PRs related to the vm subsystem.Issues and PRs related to the vm subsystem.
Metadata
Metadata
Assignees
Labels
duplicateIssues and PRs that are duplicates of other issues or PRs.Issues and PRs that are duplicates of other issues or PRs.v8 engineIssues and PRs related to the V8 dependency.Issues and PRs related to the V8 dependency.vmIssues and PRs related to the vm subsystem.Issues and PRs related to the vm subsystem.
v8.1.4Linux stbx-frontend-dev 3.13.0-35-generic #62-Ubuntu SMP Fri Aug 15 01:58:42 UTC 2014 x86_64 x86_64 x86_64 GNU/LinuxIt looks like process of creating new contexts got much slower in recent nodejs release.
Consider following example:
Here we're creating new context for each run and executing empty code string.
Output for nodejs 8.1.4:
Output for nodejs 6:
However, if we're reusing one context instead of creating new ones (like this), everything except first run is ok in nodejs 8 too:
Basically, slow part is
vm.createContext, code execution speed itself is fine (benchmark with justvm.createContext({})shows similar timings).It looks like this problem exists only on Linux (
node v8.1.2onDarwin resure-osx 16.6.0 Darwin Kernel Version 16.6.0: Fri Apr 14 16:21:16 PDT 2017; root:xnu-3789.60.24~6/RELEASE_X86_64 x86_64is as fast as node 6).