diff options
author | Dan <dan.d.wolff@gmail.com> | 2018-02-26 04:46:26 +0100 |
---|---|---|
committer | Alex Lam S.L <alexlamsl@gmail.com> | 2018-02-26 11:46:26 +0800 |
commit | ba7bad0dbdc373493daa6f2fbb03418f77df563a (patch) | |
tree | 5fdd6f1e4a81be30916dfcf936e5ec2571b1233c | |
parent | b8b2ac5230f4ea94ddc6fdb407825b6d2ff7da8d (diff) | |
download | tracifyjs-ba7bad0dbdc373493daa6f2fbb03418f77df563a.tar.gz tracifyjs-ba7bad0dbdc373493daa6f2fbb03418f77df563a.zip |
show benchmark subtotal (#2960)
At the end of the benchmark, sums of the input, output and
gzip values are shown, such as:
Subtotal
Original: 7785102 bytes
Uglified: 2283862 bytes
GZipped: 662354 bytes
-rw-r--r-- | test/benchmark.js | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/test/benchmark.js b/test/benchmark.js index 59383606..4ab76260 100644 --- a/test/benchmark.js +++ b/test/benchmark.js @@ -28,6 +28,7 @@ var remaining = 2 * urls.length; function done() { if (!--remaining) { var failures = []; + var sum = { input: 0, output: 0, gzip: 0 }; urls.forEach(function(url) { var info = results[url]; console.log(); @@ -40,6 +41,9 @@ function done() { if (info.code) { failures.push(url); } + sum.input += info.input; + sum.output += info.output; + sum.gzip += info.gzip; }); if (failures.length) { console.error("Benchmark failed:"); @@ -47,6 +51,13 @@ function done() { console.error(url); }); process.exit(1); + } else { + console.log(); + console.log("Subtotal"); + console.log(); + console.log("Original:", sum.input, "bytes"); + console.log("Uglified:", sum.output, "bytes"); + console.log("GZipped: ", sum.gzip, "bytes"); } } } |