diff options
author | Trevor Norris <trev.norris@gmail.com> | 2013-03-20 01:58:11 -0700 |
---|---|---|
committer | Ben Noordhuis <info@bnoordhuis.nl> | 2013-03-20 20:25:48 +0100 |
commit | 31314b697874eabe2308bd26b98b72aff3e13ef6 (patch) | |
tree | 4fdf8d633aaba4281caf511da58c2d4dcd14ce93 /benchmark/compare.js | |
parent | 3dac421393b3379bc355c2776563da8537348c26 (diff) | |
download | node-new-31314b697874eabe2308bd26b98b72aff3e13ef6.tar.gz |
bench: compare binaries equal times
The benchmark compare would drop the last run of the binary pairs. So
when they were only run once an error would arise because no data was
generated for the second binary.
Diffstat (limited to 'benchmark/compare.js')
-rw-r--r-- | benchmark/compare.js | 24 |
1 files changed, 6 insertions, 18 deletions
diff --git a/benchmark/compare.js b/benchmark/compare.js index 2e365454b6..d6ad44922d 100644 --- a/benchmark/compare.js +++ b/benchmark/compare.js @@ -48,36 +48,24 @@ if (nodes.length !== 2) var spawn = require('child_process').spawn; var results = {}; -var n = 1; +var toggle = 1; +var r = (+process.env.NODE_BENCH_RUNS || 1) * 2; run(); - -var RUNS = +process.env.NODE_BENCH_RUNS || 1; -var r = RUNS; function run() { - // Flip back and forth between the two binaries. - if (n === 1) { - n--; - } else { - r--; - if (r === 0) - return compare(); - else - n++; - } - - if (n === -1) + if (--r < 0) return compare(); + toggle = ++toggle % 2; - var node = nodes[n]; + var node = nodes[toggle]; console.error('running %s', node); var env = {}; for (var i in process.env) env[i] = process.env[i]; env.NODE = node; - var child = spawn('make', [runBench], { env: env }); var out = ''; + var child = spawn('make', [runBench], { env: env }); child.stdout.setEncoding('utf8'); child.stdout.on('data', function(c) { out += c; |