Comparing version 1.0.7 to 1.0.8
202
benchmark.js
var nodeRedis = require('redis'); | ||
var ioRedis = require('./'); | ||
var ndredis, ioredis; | ||
var thunkRedis = require('thunk-redis'); | ||
var waitReady = function (next) { | ||
var pending = 2; | ||
ndredis.on('ready', function () { | ||
if (!--pending) { | ||
next(); | ||
} | ||
}); | ||
setTimeout(function () { | ||
next(); | ||
}, 2000); | ||
// var pending = 2; | ||
// ndredis.on('ready', function () { | ||
// if (!--pending) { | ||
// next(); | ||
// } | ||
// }); | ||
ioredis.on('ready', function () { | ||
if (!--pending) { | ||
next(); | ||
} | ||
}); | ||
// ioredis.on('ready', function () { | ||
// if (!--pending) { | ||
// next(); | ||
// } | ||
// }); | ||
}; | ||
@@ -24,4 +28,8 @@ | ||
before(function (start) { | ||
ndredis = nodeRedis.createClient(); | ||
ioredis = new ioRedis(); | ||
tkredis = thunkRedis.createClient(6380); | ||
ioredis = new ioRedis.Cluster([ | ||
{ port: 6380, host: '127.0.0.1' }, | ||
{ port: 6381, host: '127.0.0.1' }, | ||
{ port: 6382, host: '127.0.0.1' } | ||
]); | ||
waitReady(start); | ||
@@ -35,102 +43,102 @@ }); | ||
bench('node_redis', function(next) { | ||
ndredis.set('foo', 'bar', next); | ||
tkredis.set('foo', 'bar')(next); | ||
}); | ||
after(function () { | ||
ndredis.quit(); | ||
ioredis.quit(); | ||
// ndredis.quit(); | ||
// ioredis.quit(); | ||
}); | ||
}); | ||
suite('simple get', function() { | ||
set('mintime', 5000); | ||
set('concurrency', 50); | ||
before(function (start) { | ||
ndredis = nodeRedis.createClient(); | ||
ioredis = new ioRedis(); | ||
waitReady(function () { | ||
ndredis.set('foo', 'bar', start); | ||
}); | ||
}); | ||
// suite('simple get', function() { | ||
// set('mintime', 5000); | ||
// set('concurrency', 50); | ||
// before(function (start) { | ||
// ndredis = nodeRedis.createClient(); | ||
// ioredis = new ioRedis(); | ||
// waitReady(function () { | ||
// ndredis.set('foo', 'bar', start); | ||
// }); | ||
// }); | ||
bench('ioredis', function(next) { | ||
ioredis.get('foo', next); | ||
}); | ||
// bench('ioredis', function(next) { | ||
// ioredis.get('foo', next); | ||
// }); | ||
bench('node_redis', function(next) { | ||
ndredis.get('foo', next); | ||
}); | ||
// bench('node_redis', function(next) { | ||
// ndredis.get('foo', next); | ||
// }); | ||
after(function () { | ||
ndredis.quit(); | ||
ioredis.quit(); | ||
}); | ||
}); | ||
// after(function () { | ||
// ndredis.quit(); | ||
// ioredis.quit(); | ||
// }); | ||
// }); | ||
suite('simple get with pipeline', function() { | ||
set('mintime', 5000); | ||
set('concurrency', 50); | ||
before(function (start) { | ||
ndredis = nodeRedis.createClient(); | ||
ioredis = new ioRedis(); | ||
waitReady(function () { | ||
ndredis.set('foo', 'bar', start); | ||
}); | ||
}); | ||
// suite('simple get with pipeline', function() { | ||
// set('mintime', 5000); | ||
// set('concurrency', 50); | ||
// before(function (start) { | ||
// ndredis = nodeRedis.createClient(); | ||
// ioredis = new ioRedis(); | ||
// waitReady(function () { | ||
// ndredis.set('foo', 'bar', start); | ||
// }); | ||
// }); | ||
bench('ioredis', function(next) { | ||
var pipeline = ioredis.pipeline(); | ||
for (var i = 0; i < 10; ++i) { | ||
pipeline.get('foo'); | ||
} | ||
pipeline.exec(next); | ||
}); | ||
// bench('ioredis', function(next) { | ||
// var pipeline = ioredis.pipeline(); | ||
// for (var i = 0; i < 10; ++i) { | ||
// pipeline.get('foo'); | ||
// } | ||
// pipeline.exec(next); | ||
// }); | ||
bench('node_redis', function(next) { | ||
var pending = 0; | ||
for (var i = 0; i < 10; ++i) { | ||
pending += 1; | ||
ndredis.get('foo', check); | ||
} | ||
function check() { | ||
if (!--pending) { | ||
next(); | ||
} | ||
} | ||
}); | ||
// bench('node_redis', function(next) { | ||
// var pending = 0; | ||
// for (var i = 0; i < 10; ++i) { | ||
// pending += 1; | ||
// ndredis.get('foo', check); | ||
// } | ||
// function check() { | ||
// if (!--pending) { | ||
// next(); | ||
// } | ||
// } | ||
// }); | ||
after(function () { | ||
ndredis.quit(); | ||
ioredis.quit(); | ||
}); | ||
}); | ||
// after(function () { | ||
// ndredis.quit(); | ||
// ioredis.quit(); | ||
// }); | ||
// }); | ||
suite('lrange 100', function() { | ||
set('mintime', 5000); | ||
set('concurrency', 50); | ||
before(function (start) { | ||
ndredis = nodeRedis.createClient(); | ||
ioredis = new ioRedis(); | ||
waitReady(function () { | ||
var item = []; | ||
for (var i = 0; i < 100; ++i) { | ||
item.push((Math.random() * 100000 | 0) + 'str'); | ||
} | ||
ndredis.del('foo'); | ||
ndredis.lpush('foo', item, start); | ||
}); | ||
}); | ||
// suite('lrange 100', function() { | ||
// set('mintime', 5000); | ||
// set('concurrency', 50); | ||
// before(function (start) { | ||
// ndredis = nodeRedis.createClient(); | ||
// ioredis = new ioRedis(); | ||
// waitReady(function () { | ||
// var item = []; | ||
// for (var i = 0; i < 100; ++i) { | ||
// item.push((Math.random() * 100000 | 0) + 'str'); | ||
// } | ||
// ndredis.del('foo'); | ||
// ndredis.lpush('foo', item, start); | ||
// }); | ||
// }); | ||
bench('ioredis', function(next) { | ||
ioredis.lrange('foo', 0, 99, next); | ||
}); | ||
// bench('ioredis', function(next) { | ||
// ioredis.lrange('foo', 0, 99, next); | ||
// }); | ||
bench('node_redis', function(next) { | ||
ndredis.lrange('foo', 0, 99, next); | ||
}); | ||
// bench('node_redis', function(next) { | ||
// ndredis.lrange('foo', 0, 99, next); | ||
// }); | ||
after(function () { | ||
ndredis.quit(); | ||
ioredis.quit(); | ||
}); | ||
}); | ||
// after(function () { | ||
// ndredis.quit(); | ||
// ioredis.quit(); | ||
// }); | ||
// }); |
@@ -190,2 +190,3 @@ var Redis = require('./redis'); | ||
} | ||
return command.promise; | ||
}; | ||
@@ -192,0 +193,0 @@ |
{ | ||
"name": "ioredis", | ||
"version": "1.0.7", | ||
"version": "1.0.8", | ||
"description": "A delightful, performance-focused Redis client for Node and io.js", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -31,2 +31,3 @@ # ioredis | ||
* [API Documentation](API.md) | ||
* [Changelog](Changelog.md) | ||
* [Migrating from node_redis](https://github.com/luin/ioredis/wiki/Migrating-from-node_redis) | ||
@@ -33,0 +34,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
171116
3930
521