Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 16 additions & 3 deletions benchmark/compare.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
var usage = 'node benchmark/compare.js ' +
'<node-binary1> <node-binary2> ' +
'[--html] [--red|-r] [--green|-g]';
'[--html] [--red|-r] [--green|-g] ' +
'[-- <type> [testFilter]]';

var show = 'both';
var nodes = [];
var html = false;
var benchmarks;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't [testFilter] and benchmarks be options?

https://github.com/iojs/io.js/blob/v1.x/benchmark/common.js#L62

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure what you mean. AFAIK using require('./common').createBenchmark() won't work well because it spawns tests with stdio: 'inherit', so you can't capture the output needed for comparing.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.


for (var i = 2; i < process.argv.length; i++) {
var arg = process.argv[i];
Expand All @@ -21,8 +23,15 @@ for (var i = 2; i < process.argv.length; i++) {
case '-h': case '-?': case '--help':
console.log(usage);
process.exit(0);
break;
case '--':
benchmarks = [];
break;
default:
nodes.push(arg);
if (Array.isArray(benchmarks))
benchmarks.push(arg);
else
nodes.push(arg);
break;
}
}
Expand Down Expand Up @@ -65,7 +74,11 @@ function run() {
env.NODE = node;

var out = '';
var child = spawn('make', [runBench], { env: env });
var child;
if (Array.isArray(benchmarks) && benchmarks.length)
child = spawn(node, ['benchmark/common.js'].concat(benchmarks), { env: env });
else
child = spawn('make', [runBench], { env: env });
child.stdout.setEncoding('utf8');
child.stdout.on('data', function(c) {
out += c;
Expand Down