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

benchmark: add benchmark for vm.createContext #29845

Changes from all commits
File filter...
Filter file types
Jump to…
Jump to file or symbol
Failed to load files and symbols.


Just for now

benchmark: add benchmark for vm.createContext

  • Loading branch information
joyeecheung committed Oct 4, 2019
commit a1e1928bc498f522e8b0ea28a2efa2da1586a87e
@@ -0,0 +1,24 @@
'use strict';

const common = require('../common.js');

const bench = common.createBenchmark(main, {
n: [100]

const vm = require('vm');

const ctxFn = new vm.Script(`
var b = Math.random();
var c = a + b;

function main({ n }) {
let context;
for (let i = 0; i < n; i++) {
context = vm.createContext({ a: 'a' });
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.