Skip to content

Commit

Permalink
Benchmark
Browse files Browse the repository at this point in the history
  • Loading branch information
TheDeveloper committed Aug 29, 2014
1 parent f1e048c commit 63f77a9
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 2 deletions.
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,7 @@ run = $(RUNNER) -R $(REPORTER) $(2) $(1)
test:
$(call run,./test/warlock.js)

bench:
$(call run,./test/bench.js)

.PHONY: test
6 changes: 4 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,13 @@
},
"homepage": "https://github.com/thedeveloper/warlock",
"dependencies": {
"node-redis-scripty": "~0.0.4"
"node-redis-scripty": "~0.0.4",
"uuid": "^1.4.1"
},
"devDependencies": {
"should": "^3.1.3",
"mocha": "^1.17.1",
"redis": "^0.10.1"
"redis": "^0.10.1",
"async": "^0.9.0"
}
}
25 changes: 25 additions & 0 deletions test/bench.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
var redis = require('./setup/redisConnection');
var warlock = require('../lib/warlock')(redis);
var async = require('async');
require('./setup/redisFlush');

describe('benchmark', function() {
it('lock', function(done) {
var start = Date.now();
async.times(
10000,
function(n, cb) {
warlock.lock(''+Math.random(), 10000, cb);
},
function(err) {
if (err) {
console.trace(err);
}

var end = Date.now();
var delta = end - start;
done();
});
});
});

0 comments on commit 63f77a9

Please sign in to comment.