• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1'use strict';
2
3const common = require('../common.js');
4
5const bench = common.createBenchmark(main, {
6  n: [100000],
7});
8
9const vm = require('vm');
10const script = new vm.Script(`
11  globalThis.foo++;
12`);
13const context = vm.createContext({ foo: 1 });
14
15function main({ n }) {
16  bench.start();
17  for (let i = 0; i < n; i++) {
18    script.runInContext(context);
19  }
20  bench.end(n);
21}
22