You've already forked node-redis
mirror of
https://github.com/redis/node-redis.git
synced 2025-08-06 02:15:48 +03:00
update benchmarks
This commit is contained in:
19
benchmark/lib/ping/ioredis.js
Normal file
19
benchmark/lib/ping/ioredis.js
Normal file
@@ -0,0 +1,19 @@
|
||||
import Redis from 'ioredis';
|
||||
|
||||
export default async (host) => {
|
||||
const client = new Redis({
|
||||
host,
|
||||
lazyConnect: true
|
||||
});
|
||||
|
||||
await client.connect();
|
||||
|
||||
return {
|
||||
benchmark() {
|
||||
return client.ping();
|
||||
},
|
||||
teardown() {
|
||||
return client.disconnect();
|
||||
}
|
||||
}
|
||||
};
|
9
benchmark/lib/ping/ping.yml
Normal file
9
benchmark/lib/ping/ping.yml
Normal file
@@ -0,0 +1,9 @@
|
||||
name: "ping"
|
||||
|
||||
clientconfig:
|
||||
- command: |
|
||||
npm install -ws
|
||||
npm run build:tests-tools
|
||||
cd benchmark
|
||||
npm install
|
||||
npm run start -- --name ping --redis-server-host ${server_private_ip}
|
21
benchmark/lib/ping/v3.js
Normal file
21
benchmark/lib/ping/v3.js
Normal file
@@ -0,0 +1,21 @@
|
||||
import { createClient } from 'redis-v3';
|
||||
import { once } from 'events';
|
||||
import { promisify } from 'util';
|
||||
|
||||
export default async (host) => {
|
||||
const client = createClient({ host }),
|
||||
pingAsync = promisify(client.ping).bind(client),
|
||||
quitAsync = promisify(client.quit).bind(client);
|
||||
|
||||
await once(client, 'connect');
|
||||
|
||||
return {
|
||||
benchmark() {
|
||||
return pingAsync();
|
||||
},
|
||||
teardown() {
|
||||
return quitAsync();
|
||||
}
|
||||
};
|
||||
|
||||
};
|
16
benchmark/lib/ping/v4.js
Normal file
16
benchmark/lib/ping/v4.js
Normal file
@@ -0,0 +1,16 @@
|
||||
import { createClient } from '@node-redis/client';
|
||||
|
||||
export default async (host) => {
|
||||
const client = createClient({ host });
|
||||
|
||||
await client.connect();
|
||||
|
||||
return {
|
||||
benchmark() {
|
||||
return client.ping();
|
||||
},
|
||||
teardown() {
|
||||
return client.disconnect();
|
||||
}
|
||||
};
|
||||
};
|
Reference in New Issue
Block a user