• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1'use strict';
2
3const common = require('../common.js');
4
5const bench = common.createBenchmark(main, {
6  n: [1],
7  breakOnSigint: [0, 1],
8  withSigintListener: [0, 1]
9});
10
11const vm = require('vm');
12
13function main({ n, breakOnSigint, withSigintListener }) {
14  const options = breakOnSigint ? { breakOnSigint: true } : {};
15
16  process.removeAllListeners('SIGINT');
17  if (withSigintListener)
18    process.on('SIGINT', () => {});
19
20  bench.start();
21  for (let i = 0; i < n; i++)
22    vm.runInThisContext('0', options);
23  bench.end(n);
24}
25