Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Adding percentage outputs to diff_multi_bench_output.js

Adding missing dev dependencies to package.json
  • Loading branch information...
commit ccd4a2b8a3acc5b0324ec41525d83c1b2909707d 1 parent 92ed0be
Bryce Baril brycebaril authored
Showing with 30 additions and 21 deletions.
  1. +8 −5 diff_multi_bench_output.js
  2. +22 −16 package.json
13 diff_multi_bench_output.js
View
@@ -50,20 +50,22 @@ before_lines.forEach(function(b, i) {
if (ops.length != 2) return
var delta = ops[1] - ops[0];
+ var pct = ((delta / ops[0]) * 100).toPrecision(3);
total_ops.update(delta);
delta = humanize_diff(delta);
+ pct = humanize_diff(pct, '%');
console.log(
// name of test
command_name(a_words) == command_name(b_words)
? command_name(a_words) + ':'
: '404:',
// results of test
- ops.join(' -> '), 'ops/sec (∆', delta, ')');
+ ops.join(' -> '), 'ops/sec (∆', delta, pct, ')');
});
-console.log('Mean difference in ops/sec:', humanize_diff(total_ops.mean()));
+console.log('Mean difference in ops/sec:', humanize_diff(total_ops.mean().toPrecision(6)));
function is_whitespace(s) {
return !!s.trim();
@@ -74,11 +76,12 @@ function parseInt10(s) {
}
// green if greater than 0, red otherwise
-function humanize_diff(num) {
+function humanize_diff(num, unit) {
+ unit = unit || "";
if (num > 0) {
- return ('+' + num).green;
+ return ('+' + num + unit).green;
}
- return ('' + num).red;
+ return ('' + num + unit).red;
}
function command_name(words) {
38 package.json
View
@@ -1,17 +1,23 @@
-{ "name" : "redis",
- "version" : "0.8.2",
- "description" : "Redis client library",
- "keywords" : [ "redis", "database" ],
- "author": "Matt Ranney <mjr@ranney.com>",
- "main": "./index.js",
- "scripts": {
- "test": "node ./test.js"
- },
- "devDependencies": {
- "metrics": ">=0.1.5"
- },
- "repository": {
- "type": "git",
- "url": "git://github.com/mranney/node_redis.git"
- }
+{
+ "name": "redis",
+ "version": "0.8.2",
+ "description": "Redis client library",
+ "keywords": [
+ "redis",
+ "database"
+ ],
+ "author": "Matt Ranney <mjr@ranney.com>",
+ "main": "./index.js",
+ "scripts": {
+ "test": "node ./test.js"
+ },
+ "devDependencies": {
+ "metrics": ">=0.1.5",
+ "colors": "~0.6.0-1",
+ "underscore": "~1.4.4"
+ },
+ "repository": {
+ "type": "git",
+ "url": "git://github.com/mranney/node_redis.git"
+ }
}
Please sign in to comment.
Something went wrong with that request. Please try again.