PR-URL: #14162 Reviewed-By: Vse Mozhet Byt <vsemozhetbyt@gmail.com> Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: Timothy Gu <timothygu99@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
28 lines
578 B
JavaScript
28 lines
578 B
JavaScript
'use strict';
|
|
|
|
const common = require('../common.js');
|
|
|
|
const bench = common.createBenchmark(main, {
|
|
n: [1],
|
|
breakOnSigint: [0, 1],
|
|
withSigintListener: [0, 1]
|
|
});
|
|
|
|
const vm = require('vm');
|
|
|
|
function main(conf) {
|
|
const n = +conf.n;
|
|
const options = conf.breakOnSigint ? { breakOnSigint: true } : {};
|
|
const withSigintListener = !!conf.withSigintListener;
|
|
|
|
process.removeAllListeners('SIGINT');
|
|
if (withSigintListener)
|
|
process.on('SIGINT', () => {});
|
|
|
|
var i = 0;
|
|
|
|
bench.start();
|
|
for (; i < n; i++)
|
|
vm.runInThisContext('0', options);
|
|
bench.end(n);
|
|
}
|