Repository navigation
VM: VM is much slower when timeout was specified #10453
Copy link
Copy link
Closed
Labels
docIssues and PRs related to Node.js documentation.Issues and PRs related to Node.js documentation.performanceIssues and PRs related to the performance of Node.js.Issues and PRs related to the performance of Node.js.questionIssues asking questions about Node.js.Issues asking questions about Node.js.vmIssues and PRs related to the vm subsystem.Issues and PRs related to the vm subsystem.
Description
Activity
- addedperformanceIssues and PRs related to the performance of Node.js.Issues and PRs related to the performance of Node.js.vmIssues and PRs related to the vm subsystem.Issues and PRs related to the vm subsystem.
on Dec 25, 2016 When
timeoutoption was specified, Script execution on VM is much slower thentimeoutoptions wasn't specified.The script execution isn’t slower, but of course there’s overhead associated with setting up the timer and stopping it again (especially because Node can’t use its usual facilities for that), which happens once for each
runInContextcall.You can move the
forloop into the script itself and the difference should vanish. You can feel free to open a PR against the documentation, of course.- addeddocIssues and PRs related to Node.js documentation.Issues and PRs related to Node.js documentation.
on Dec 25, 2016 Also on an unrelated note, using the
letin theforlike that is slower (not sure about node v7).- addedquestionIssues asking questions about Node.js.Issues asking questions about Node.js.
on Apr 29, 2017 - added a commit that references this issue
on Apr 29, 2017 - added a commit that references this issue
on May 6, 2017 - added 3 commits that reference this issue
on Jun 18, 2017 - added a commit that references this issue
on Jul 11, 2017 - added a commit that references this issue
on Jul 27, 2026
Metadata
Metadata
Assignees
Labels
docIssues and PRs related to Node.js documentation.Issues and PRs related to Node.js documentation.performanceIssues and PRs related to the performance of Node.js.Issues and PRs related to the performance of Node.js.questionIssues asking questions about Node.js.Issues asking questions about Node.js.vmIssues and PRs related to the vm subsystem.Issues and PRs related to the vm subsystem.
Node.js v6.7.0 / Node.js 4.4.2
Ubuntu 14.04 LTS x64 (v6.7.0) / macOS Sierra (v4.4.2)
VM
I just found there's unexpected behavior on
timeoutoption ofvm.runInContext.When
timeoutoption was specified, Script execution on VM is much slower thentimeoutoptions wasn't specified.This is two of example snippets to reproduce that problem:
vm-normal.js
vm-with-timeout.js
I think maybe that's not a bug (timer for timeout is expansive?), but that's unexpected behavior. It would be nice if that limitation should be documented on VM API documentation.