-
Notifications
You must be signed in to change notification settings - Fork 28
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
get rid of str_len() #6
Comments
Depending on the details of the change, I have the same concerns about timing as I expressed in #7. |
There are also some friends, see the std-functions branch. |
I did some tests and it turns out the glibc versions are so much faster. strlen is faster than str_len, strncmp is faster than str_diffn, strrchr is faster than str_rchr and so on. Curious to know what makes the glibc versions faster. This is just one of the test I carried out. Searching for one byte in a 90 byte character string in a for() loop 1 million times. The difference is huge. str_rchr real 0m0.657s strrchr real 0m0.020s I got similar results for strlen and other functions. |
They are faster because of multiple reasons:
No idea which of these happens for you, but exactly those are the reasons to get rid of them. |
strlen() is one of the functions that a compiler usually optimizes away, given much more efficient implementations can be done on todays SIMD processors. The old implementation uses loop unrolling, a common 90's optimization technique that has usually lost it's benefit today.
The text was updated successfully, but these errors were encountered: