Skip to content

Commit 01f3b46

Browse files
committed
benchmark: Support passing v8 flags to benchmarks
The better to test --use-strict effects on performance. (Spoiler: it has no measurable effect on performance.)
1 parent fbb963b commit 01f3b46

1 file changed

Lines changed: 20 additions & 18 deletions

File tree

benchmark/common.js

Lines changed: 20 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -18,28 +18,30 @@ if (module === require.main) {
1818
var spawn = require('child_process').spawn;
1919

2020
runBenchmarks();
21+
}
2122

22-
function runBenchmarks() {
23-
var test = tests.shift();
24-
if (!test)
25-
return;
23+
function runBenchmarks() {
24+
var test = tests.shift();
25+
if (!test)
26+
return;
2627

27-
if (test.match(/^[\._]/))
28-
return process.nextTick(runBenchmarks);
28+
if (test.match(/^[\._]/))
29+
return process.nextTick(runBenchmarks);
2930

30-
console.error(type + '/' + test);
31-
test = path.resolve(dir, test);
31+
console.error(type + '/' + test);
32+
test = path.resolve(dir, test);
3233

33-
var child = spawn(process.execPath, [ test ], { stdio: 'inherit' });
34-
child.on('close', function(code) {
35-
if (code)
36-
process.exit(code);
37-
else {
38-
console.log('');
39-
runBenchmarks();
40-
}
41-
});
42-
}
34+
var a = process.execArgv || [];
35+
a.push(test);
36+
var child = spawn(process.execPath, a, { stdio: 'inherit' });
37+
child.on('close', function(code) {
38+
if (code)
39+
process.exit(code);
40+
else {
41+
console.log('');
42+
runBenchmarks();
43+
}
44+
});
4345
}
4446

4547
exports.createBenchmark = function(fn, options) {

0 commit comments

Comments
 (0)