We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
19.6.0 Darwin Kernel Version 19.6.0: Tue Jan 12 22:13:05 PST 2021; root:xnu-6153.141.16~1/RELEASE_X86_64 x86_64
running:
const vm = require("vm"); const script = ` (exports) => { exports.fn = () => { for (let i = 0; i < 10000; i++) { x; } }; }; `; global.x = 0; eval(script)(exports); console.time("eval"); exports.fn(); console.timeEnd("eval"); vm.runInNewContext(script, { x: 0 })(exports); console.time("vm"); exports.fn(); console.timeEnd("vm");
results in:
eval: 0.251ms vm: 1.124ms
consistently reproducible.
global variable access in new context should be approximately as fast as code running in global context.
global variable access in new context takes anywhere between 2x-10x more time than in global context.
The text was updated successfully, but these errors were encountered:
I think it's a duplicate of #31658
Sorry, something went wrong.
ah, seems like it, thanks! thought I searched thoroughly...
No branches or pull requests
19.6.0 Darwin Kernel Version 19.6.0: Tue Jan 12 22:13:05 PST 2021; root:xnu-6153.141.16~1/RELEASE_X86_64 x86_64
What steps will reproduce the bug?
running:
results in:
How often does it reproduce? Is there a required condition?
consistently reproducible.
What is the expected behavior?
global variable access in new context should be approximately as fast as code running in global context.
What do you see instead?
global variable access in new context takes anywhere between 2x-10x more time than in global context.
The text was updated successfully, but these errors were encountered: