Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

perf: use map for the in-memory store #353

Merged
merged 1 commit into from
Dec 19, 2023
Merged

perf: use map for the in-memory store #353

merged 1 commit into from
Dec 19, 2023

Conversation

gurgunday
Copy link
Member

Reference: kibertoad/toad-cache#40
Benchmark: kibertoad/nodejs-benchmark-tournament#12

TLDR, I've discovered a 50%+ improvement in the lookup performance of non-numeric keys when a map is used instead of an object

In rate-limit, the key of a request is by default its IP address, so we should benefit directly from the change

@gurgunday gurgunday merged commit 02580a4 into fastify:master Dec 19, 2023
19 checks passed
@gurgunday gurgunday deleted the use-map-lru branch December 19, 2023 11:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants