public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jerry Quinn <jlquinn@optonline.net>
To: Kevin Atkinson <kevina@gnu.org>
Cc: gcc@gcc.gnu.org
Subject: Re: Slow memcmp for aligned strings on Pentium 3
Date: Sun, 06 Apr 2003 05:54:00 -0000	[thread overview]
Message-ID: <16015.39995.61148.812914@gargle.gargle.HOWL> (raw)
In-Reply-To: <Pine.LNX.4.44.0304041007080.912-100000@kevin-pc.atkinson.dhs.org>

Kevin Atkinson writes:
 > 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().

Adding iterations didn't change the relative scores significantly.  It
still loses big on P4.  It also loses big on Athlon.  Here are Athlon
results using the later version you posted with 10x iterations:

jlquinn@smaug:~/gcc/test$ gcc3.3 -O3 -fomit-frame-pointer -march=athlon cmps.c 
jlquinn@smaug:~/gcc/test$ ./a.out 
Memory compare 15 bytes:
  310000
  5810000
  Speed up: 0.053356
Memory compare 16 bytes:
  300000
  5290000
  Speed up: 0.056711
Memory compare 64 bytes:
  460000
  13770000
  Speed up: 0.033406
Memory compare 256 bytes:
  470000

Jerry Quinn

  reply	other threads:[~2003-04-06  3:15 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-04-04 17:13 Jerry Quinn
2003-04-04 17:29 ` Kevin Atkinson
2003-04-06  5:54   ` Jerry Quinn [this message]
2003-04-06 22:17     ` Kevin Atkinson
2003-04-07 17:30       ` Jerry Quinn
  -- strict thread matches above, loose matches on Subject: below --
2003-04-04 14:33 Bonzini
2003-04-04 13:18 Roger Sayle
2003-04-04 14:51 ` Kevin Atkinson
2003-04-04 17:08 ` Kevin Atkinson
2003-04-04 18:58   ` Marcel Cox
2003-04-04 19:27     ` Kevin Atkinson
2003-04-04  6:22 Kevin Atkinson
2003-04-04  8:52 ` Zack Weinberg
2003-04-04 15:16   ` Kevin Atkinson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=16015.39995.61148.812914@gargle.gargle.HOWL \
    --to=jlquinn@optonline.net \
    --cc=gcc@gcc.gnu.org \
    --cc=kevina@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).