From db1299005422bce9325f2b77e755ffcd3ea3a6ab Mon Sep 17 00:00:00 2001 From: Tj Holowaychuk Date: Fri, 17 Sep 2010 18:49:07 -0700 Subject: [PATCH] synopsis --- bench.js | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/bench.js b/bench.js index 2d9b693a71..e761641183 100644 --- a/bench.js +++ b/bench.js @@ -69,7 +69,6 @@ var queue = [ function(){ fs.writeFileSync(path, JSON.stringify(curr), 'ascii'); - console.log(); client.end(); } ]; @@ -91,11 +90,13 @@ function report(label) { ? c > p + 50 ? 31 : 33 - : 32; - console.log(' \x1b[' + col + ';1m%s\x1b[0m:', label); + : 32 + , synopsis = c > p + ? '-' + (c - p) + : '+' + (p - c); + while (synopsis.length + label.length < 20) synopsis = ' ' + synopsis; + console.log(' \x1b[' + col + ';1m%s\x1b[0m: %s', label, synopsis); console.log(' \x1b[33mprev\x1b[0m: %d ms', p); console.log(' \x1b[33mcurr\x1b[0m: %d ms', c); - if (c > p) { - console.log(' previously was \x1b[33m%d\x1b[0m ms faster', c - p); - } + console.log(); } \ No newline at end of file