bench: Add flag to be silent in runner
authorisaacs <i@izs.me>
Sun, 3 Mar 2013 23:44:36 +0000 (15:44 -0800)
committerisaacs <i@izs.me>
Tue, 5 Mar 2013 22:23:01 +0000 (14:23 -0800)
This is helpful in tracking down bailouts and deopts in Stream classes,
without triggering one from the string write in console.log

benchmark/common.js

index 3c478bd..bfbb054 100644 (file)
@@ -1,5 +1,6 @@
 var assert = require('assert');
 var path = require('path');
+var silent = +process.env.NODE_BENCH_SILENT;
 
 exports.PORT = process.env.PORT || 12346;
 
@@ -184,7 +185,8 @@ Benchmark.prototype.end = function(operations) {
 
 Benchmark.prototype.report = function(value) {
   var heading = this.getHeading();
-  console.log('%s: %s', heading, value.toPrecision(5));
+  if (!silent)
+    console.log('%s: %s', heading, value.toPrecision(5));
   process.exit(0);
 };