Skip to content

Instantly share code, notes, and snippets.

@Jmgr
Created June 28, 2021 08:57
Show Gist options
  • Save Jmgr/b8f7edc6cd1021bbbcae19806f7895d0 to your computer and use it in GitHub Desktop.
Save Jmgr/b8f7edc6cd1021bbbcae19806f7895d0 to your computer and use it in GitHub Desktop.
let start;
const node_redis = require('redis');
const ioredis = require("ioredis");
const args = [
<script sha>,
<script arguments...>
]
const nrClient = node_redis.createClient(<port>, <address>);
const ioClient = new ioredis();
const rounds = 100_000;
Promise.all([
new Promise(res => nrClient.once('ready', res)),
new Promise(res => ioClient.once('ready', res))
]).then(() => {
console.log("ready")
start = new Date();
for(let i=0; i<rounds; i++) {
nrClient.send_command('evalsha', args, () => {})
}
console.log("nrclient", new Date() - start)
start = new Date();
for(let i=0; i<rounds; i++) {
ioClient.send_command('evalsha', args, () => {})
}
console.log("ioclient", new Date() - start)
process.exit(0)
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment