Skip to content

Commit 76d147c

Browse files
committed
Add more iterations to rate limiting memory test
1 parent 77d63f2 commit 76d147c

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

benchmarks/rate-limiting/memory.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ const { RateLimiter } = require("../../build/ratelimiting/RateLimiter");
22

33
const ttl = 60000; // 1 minute in milliseconds
44
const keyCount = 1_000_000;
5+
const checksPerKey = 10;
56

67
(async () => {
78
const keys = Array.from({ length: keyCount }, (_, i) => `user${i}`);
@@ -18,7 +19,9 @@ const keyCount = 1_000_000;
1819
const heapUsedBefore = process.memoryUsage().heapUsed;
1920

2021
for (const key of keys) {
21-
limiter.isAllowed(key, ttl, 2);
22+
for (let i = 0; i < checksPerKey; i++) {
23+
limiter.isAllowed(key, ttl, 2);
24+
}
2225
}
2326

2427
global.gc();

0 commit comments

Comments
 (0)