-
-
Notifications
You must be signed in to change notification settings - Fork 86
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
Premature optimiztion #617
Comments
I didn't make a PR because I wasn't sure if changing the order of |
It is entirely possible for a branchy approach to do even slightly better than the mostly branchless approach that we use in some tests where the protocol is predictable. E.g., if you know that the protocol will be "http", first checking for "http" might save the hashing cost. However, the hashing approach has the benefit of providing consistent worst case performance: you always do at most one string comparison... as opposed to scanning the whole set in the worst case. I will add a comment in the code. |
See PR #618 where the design choice gets explained. |
I saw your conference, in this slide you seem to be proud of this code:
Here I'm gonna give you a simpler solution that is also faster:
Why?:
GCC:
Clang:
Unrelated note:
I don't think we really need that enum to be detailed, we just need these values because that's the only ones that affect the algorithms:
Benchmark Soruce
The text was updated successfully, but these errors were encountered: