[PATCH] strcasestr: check if ne[0] is in hs with strchr or strpbrk as does strstr

Noah Goldstein goldstein.w.n@gmail.com
Mon Oct 16 16:56:00 GMT 2023


On Mon, Oct 16, 2023 at 8:52 AM Wilco Dijkstra <Wilco.Dijkstra@arm.com> wrote:
>
> Hi Adhemerval/James,
>
> > We have the sysdep folder exactly to provide such macros if requires, for instance
> > the file sysdeps/generic/string-fzi.h.
> >
> > So if this optimization is really worth, the best way to provide would be through
> > a generic implementation like:
>
> I ran it on my x86 machine (with proper AVX-512), and the "optimized" strcspn is
> slower than the simple byte loop on bench-strcasestr.

"optimized" being the sse4 version?

> While the benchmark could
> likely be improved, it shows this target specific optimization isn't worth doing.
>
> Cheers,
> Wilco


More information about the Libc-alpha mailing list