[PATCH v7 2/2] Optimize bsearch() implementation for performance

DJ Delorie dj@redhat.com
Thu Sep 12 17:12:02 GMT 2024


Kuan-Wei Chiu <visitorckw@gmail.com> writes:
> I tried adding unlikely(), but it seems that gcc generates the exact
> same code (Note: I only checked on x86). As for moving the > 0 test
> first, I also gave it a try, but it actually worsened the benchmark
> results. I haven’t looked closely at the generated code to understand
> why, but here are the benchmark results:

Weird.  Maybe gcc is so complex that the usual ideas just don't work any
more?  Oh well, the numbers are what counts.



More information about the Libc-alpha mailing list