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: [RFC] Improve strcpy: Faster ssse3 version.


On 09/10/2013 11:19 AM, OndÅej BÃlka wrote:
> Hi, 
> 
> I also wrote a ssse3 version with same optimized header. 
> 
> On core2 and xeon it has similar performance to unaligned loads for small inputs
> and is slightly faster than current ssse3 on large inputs.
> http://kam.mff.cuni.cz/~ondra/benchmark_string/core2/strcpy_profile/results_rand/result.html
> These factors cause this implementation to be 20% faster on profiling in
> block mode. There inputs are bit atypical as most time is spend bash and
> it copies quite large strings which make ssse3 version faster than
> unaligned one.
> http://kam.mff.cuni.cz/~ondra/benchmark_string/core2/strcpy_profile/results_gcc/result.html
> 
> A change is in loop and code to setup/cleanup loop so what is best way to add this?

I don't understand, what tradeoff are you looking at?
 
> Also there would be third implementation by that mechanically replacing palignr
> with shifts avoids ssse3. How should incorporate that?

That's a good question, and I don't have a good answer.

> Currently I use separate files which are almost identical, diff is below.
> 
> Comments?

We have two options as I see it.

Macroize everything and use templates with different macro implementations.

or

Use assembler functions.

My preference, from working in the Linux kernel, is to use assembler
functions (which are used extensively in several ports). I've always felt
that assembler functions were easier to write and maintain than long 
rambling \ delimited macros that follow often annoying cpp macro rules.
You still have template files, but you use macros for big functions,
and single instruction replacements can still use a cpp macro.

Comments?

Cheers,
Carlos.


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