diff options
author | Brian White <mscdex@mscdex.net> | 2015-02-04 11:11:48 -0500 |
---|---|---|
committer | cjihrig <cjihrig@gmail.com> | 2015-02-04 16:55:18 -0500 |
commit | e0730eeaa5231841a7eba080c8170e41278c3c52 (patch) | |
tree | 76b8e8272b2dc25feedfd486f618aa600af642bc /benchmark | |
parent | 96ffcb9a210a2fa1248ae5931290193573512a96 (diff) | |
download | nodejs-e0730eeaa5231841a7eba080c8170e41278c3c52.tar.gz nodejs-e0730eeaa5231841a7eba080c8170e41278c3c52.tar.bz2 nodejs-e0730eeaa5231841a7eba080c8170e41278c3c52.zip |
benchmark: allow compare via fine-grained filters
Before this commit, only benchmark targets defined in Makefile could
be used. This commit allows execution of common.js directly and
passing of filter arguments directly, allowing you to run either a
subset of benchmarks or a single specific benchmark for comparison.
PR-URL: https://github.com/iojs/io.js/pull/711
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
Diffstat (limited to 'benchmark')
-rw-r--r-- | benchmark/compare.js | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/benchmark/compare.js b/benchmark/compare.js index d6ad44922..edb116d0c 100644 --- a/benchmark/compare.js +++ b/benchmark/compare.js @@ -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; for (var i = 2; i < process.argv.length; i++) { var arg = process.argv[i]; @@ -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; } } @@ -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; |