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]

Re: Extremely bad performance compiling bzip2



  In message <Pine.LNX.3.91.981207180935.1228A-100000@in58.in.helsinki.fi>you w
rite:
  > I upgraded my system from libc5 and gcc 2.7.2.1 to glibc2 2.0.6 and
  > egcs 1.1.1 over the weekend. Everything seems to be working, but the
  > first thing that I did to test to see if egcs was any better at
  > optimizing than gcc was to recompile bzip2, version 0.1pl2 to be
  > exact.
  > 
  > I use the latest netscape distribution as the testfile, which is a 12M
  > .bz2 file. Using the command "time bzip2 -dc nav.tar.bz2 > /dev/null"
  > as the benchmark command, my old bzip2 binary, compiled with gcc
  > 2.7.2.1 and linked to libc5, does it in 33-35 seconds.
  > 
  > The flags used to compile with the old gcc were "-O3
  > -fomit-frame-pointer -funroll-loops", which are the default ones in the
  > bzip2 distribution.
  > 
  > To make a long story short, compiling with egcs 1.1.1 and those same
  > flags and linking against glibc2, I get a running time of 58-63
  > seconds. Adding "-mcpu=pentiumpro" to the flags I get down to 52-53
  > seconds. (My machine is a K6/233 with 96M of memory). That's still 50%
  > slower than plain old gcc.
  > 
  > Is there something I'm doing wrong, or should I just accept that bzip2
  > compiled with egcs is dog slow? I did some tests with gzip too
  > afterwards, and gzip compiled with egcs is in the +-1% range with my
  > old gzip.
You'd have to look at the hot loops.  It may also be the case that these
problems are fixed by current snapshots.  We've done a lot of work to improve
spill code and register allocation, which can have a big impact on x86
performance.

In general, I don't recommend loop unrolling on the x86 -- unrolling loops
takes more registers, and the x86 is painfully short of registers.

jeff


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