Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork9.7k
[Cache] boost perf by wrapping keys validity checks withassert()#40317
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
Uh oh!
There was an error while loading.Please reload this page.
gggeek commentedMar 14, 2021 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
While I applaud perf increases, I have seen my fair share real life cases of caching systems which gave errors when NULL cache keys were being generated. The error was iirc thrown by the memcached adapter, and quite a pain to troubleshoot, as it carried no info whatsoever as to the offending bit of code. |
nicolas-grekas commentedMar 14, 2021
@gggeek I'd be fine throwing a Would you mind sending a PR doing so ? |
PSR-6 has one perf hog: checking the validity of keys.
But in practice, an invalid key should never happen in production: encoding/cleanup is a must-have, and it's a step that should be identifiedduring dev.
That's why I think we're safe wrapping these checks with
assert().On an
ArrayAdapter, this doubles the throughput of the pool when getting items.I didn't use
assert()in constructors when not on the hot path.This PR also makes some callable properties static, as they should be from the beginning.