Clean up some docs

This commit is contained in:
Jarred Sumner
2025-04-08 03:57:35 -07:00
parent 9eae7787a0
commit 02023810ba
2 changed files with 53 additions and 31 deletions

View File

@@ -0,0 +1,28 @@
import ioredis from "ioredis";
const redis = process.argv.includes("--redis=native")
? Bun.redis
: new ioredis("redis://localhost:6379", {
enableAutoPipelining: true,
});
const isBun = globalThis.Bun && redis === Bun.redis;
for (let count of [100, 1000]) {
function iterate() {
const promises = new Array(count);
for (let i = 0; i < count; i++) {
promises[i] = redis.get("greeting");
}
return Promise.all(promises);
}
const label = isBun ? `Bun.redis` : `ioredis`;
console.time(`GET 'greeting' batches of ${count} - ${label} (${count} iterations)`);
for (let i = 0; i < 1000; i++) {
await iterate();
}
console.timeEnd(`GET 'greeting' batches of ${count} - ${label} (${count} iterations)`);
}
process.exit(0);