0
0
mirror of https://github.com/nodejs/node.git synced 2024-11-30 07:27:22 +01:00
nodejs/benchmark/vm/run-in-this-context.js
Lucas Lago 3129ba2bae benchmark: remove v8ForceOptimization calls
This removes common.v8ForceOptimization calls from url and vm benchmark
files.

PR-URL: https://github.com/nodejs/node/pull/11908
Fixes: https://github.com/nodejs/node/issues/11895
Reviewed-By: Timothy Gu <timothygu99@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
2017-03-21 10:11:36 +01:00

29 lines
576 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);
}