This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH v2] x86-64: Optimize strcmp/wcscmp with AVX2


On Fri, 2018-06-01 at 18:28 +0300, Alexander Monakov wrote:
> On Fri, 1 Jun 2018, H.J. Lu wrote:
> > Please mention strncmp and wcsncmp in commit subject.  OK with this
> > change.
> 
> Many Intel CPUs reduce operating frequency upon encountering AVX
> code,
> and some have a "spin-up" period when frequency is not yet changed
> and
> AVX code runs at reduced throughput. Thus, why is this change not
> detrimental in practice, doesn't it slow down all code (including
> other
> programs running on the same core) as soon as a program makes a call
> to strcmp?

this is partially true for AVX2 FMA and AVX512. What I am proposing
contains none of the latter instructions, just AVX2 without FMA
instructions.

In the other hand, some microbenchmarks were done to see the benefit of
this effort, which is resumed on the commit description but the
complete picture is here 

https://github.com/lsandoval/strcmp-avx2-benchmark/blob/master/string-c
omparison-avx2.png

The above numbers are based on a SkyLake platform.

> 
> Alexander


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]