-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Implement NEON-accelerated version of BLOCKCONV for lowercasing and uppercasing strings #11161
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
Conversation
…ppercasing strings Since lowercasing and uppercasing is a common operation for both internal purposes and userland purposes, it makes sense to implement a NEON accelerated version for this.
@nielsdos Thank you very much! Two questions: Do all ARM64 hosts support the NEON instruction set? And second, can you benchmark this code and let us know how much it improves performance? |
The AArch64 version of the NEON instruction set (which is used here, and is not the same as the original NEON instruction set) is supported for all ARM64 hosts. See https://en.wikipedia.org/wiki/AArch64 which says
ARMv8-A is also the version of ARM that introduced the AArch64 mode, so therefore it will always be supported. Benchmarks
Important: I don't own a ARM64 machine, the tests and development of this patch were performed on an x86-64 host with qemu-user to emulate an AArch64 build of PHP. Benchmark: strtolower() Strings that are already all lowercase (1000 iterations)For a string of size 100: 1.01 ± 0.10 times faster than old approach Benchmark: strtolower() Strings where the first half is lowercase and second half is uppercase (1000 iterations)For a string of size 100: 1.18 ± 0.15 times faster than old approach Benchmark: strtolower() Strings that are all upercase (1000 iterations)For a string of size 100: 1.36 ± 0.18 times faster than old approach |
@nielsdos Looks good to me! Any comments from others? |
I don't know well to ZendEngine and SSE (NEON is not confident to little bit),
Is it okay to difference? |
The goal of |
@nielsdos Thank you very much for response. I understand. Looks good to me. |
Waiting to hear from @iluuu1994, if he feels like commenting. @nielsdos, if there are no comments after a few days, please ping me and I will merge this. |
@alexdowad I have merge access, so I can merge this myself. So I'll wait a few days for more comments and if it's all good I can merge this myself :) |
Thanks for the reviews :) |
Since lowercasing and uppercasing is a common operation for both internal purposes and userland purposes, it makes sense to implement a NEON accelerated version for this.