This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC 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: Slow memcmp for aligned strings on Pentium 3


On Fri, 4 Apr 2003, Jerry Quinn wrote:

> I just tried the same benchmark on a Pentium 4 out of curiosity.  Slightly
> different results:
> 
> Memory compare int:
>   10000
>   130000
>   Speed up: 0.076923
> Memory compare 15 bytes:
>   10000
>   370000
>   Speed up: 0.027027
> Memory compare 16 bytes:
>   20000
>   330000
>   Speed up: 0.060606
> Memory compare 64 bytes:
>   10000
>   1040000
>   Speed up: 0.009615
> Memory compare 256 bytes:
>   20000
>   2300000
>   Speed up: 0.008696
> 
> Perhaps this is to be expected since the routine uses shifts.

The shift are only used in the case size is not divisible by 4.  It seams 
that on the Pentium 4 cmps is the way to go.  You might also want to 
increase the number of loop iterations to get more meaning full results 
due the limited precision of clock().

--- 
http://kevin.atkinson.dhs.org


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