We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 77d63f2 commit 76d147cCopy full SHA for 76d147c
benchmarks/rate-limiting/memory.js
@@ -2,6 +2,7 @@ const { RateLimiter } = require("../../build/ratelimiting/RateLimiter");
2
3
const ttl = 60000; // 1 minute in milliseconds
4
const keyCount = 1_000_000;
5
+const checksPerKey = 10;
6
7
(async () => {
8
const keys = Array.from({ length: keyCount }, (_, i) => `user${i}`);
@@ -18,7 +19,9 @@ const keyCount = 1_000_000;
18
19
const heapUsedBefore = process.memoryUsage().heapUsed;
20
21
for (const key of keys) {
- limiter.isAllowed(key, ttl, 2);
22
+ for (let i = 0; i < checksPerKey; i++) {
23
+ limiter.isAllowed(key, ttl, 2);
24
+ }
25
}
26
27
global.gc();
0 commit comments