mirror of
https://github.com/nodejs/node.git
synced 2024-11-30 07:27:22 +01:00
3129ba2bae
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>
31 lines
644 B
JavaScript
31 lines
644 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;
|
|
|
|
const contextifiedSandbox = vm.createContext();
|
|
|
|
bench.start();
|
|
for (; i < n; i++)
|
|
vm.runInContext('0', contextifiedSandbox, options);
|
|
bench.end(n);
|
|
}
|