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

Efficiency #12

Open
bert-w opened this issue Sep 23, 2024 · 0 comments
Open

Efficiency #12

bert-w opened this issue Sep 23, 2024 · 0 comments

Comments

@bert-w
Copy link

bert-w commented Sep 23, 2024

return in_array($ip, abuse_ips(), true);

Why do you do an in_array check here instead of an array_key_exists? You probably want to flip this whole array so you can do a key lookup in O(1). It is horribly inefficient to use an array lookup this way since the abuse-ip array consists of over 53k IPs (and this middleware runs on every request).

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

No branches or pull requests

1 participant