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]

g++ vs egcs's g++ comparison on a K6 and PPro


Hi!
	I ran a small program on a K6 and a PPro (details below). For each
machine I compiled the code using the original gcc2.7.2.3 and the egcs
1.0.3a release with different optimisations and then ran it. The results
are surprising to me and I would appreciate any clarification especially
about the fact that the PPro results are dissapointing (in that the egcs's
g++ (called by me as eg++) produces slower code). 

Included below this text is the output obtained while executing a small C
(using complex numbers and new/delete - so not C++) program on an AMD K6
MMX @ 166Mhz, with 32MB EDO RAM (Motherboard@66Mhz), IDE HDD, running Red
Hat Linux 5.0, Kernel 2.0.32, glibc-2.0.7-6, gcc-2.7.2.3, egcs-2.90.29
980515 (egcs-1.0.3 release). I compiled egcs to make a shared library
(--enable-shared).  The g++ is that of the gcc's g++ and the eg++ is that
of the egcs's distribution.  As can be clearly seen egcs's g++ is *much*
more efficient than the gcc-2.7.2.3.  Infact there is almost a factor of 2
speed increase(this is true only when I set the optimisation options)! 
Also notice that the maximum speed is when the setting is on -O1 and
setting it to -O2 only slows it down for both gcc and egcs. The same code
on a proper Intel Pentium speeds up when I do further optimisations (i.e.
-O2 -O3 etc.). I wonder why this is so? Could some one tell me why. Also
does egcs have any special optimisations for the K6? I'm sure that the
factor of two increase in speed is amazing for a lot of people but it
would be great if more could be done! :) 

========================= AMD K6 @ 166Mhz ====================================

321.32user 0.00system 5:21.68elapsed 99%CPU (0avgtext+0avgdata 0maxresident)k
0inputs+0outputs (191major+22minor)pagefaults 0swaps
----------- g++ no optimisations --------------------------

249.36user 0.00system 4:09.37elapsed 99%CPU (0avgtext+0avgdata 0maxresident)k
0inputs+0outputs (163major+22minor)pagefaults 0swaps
------------ g++ -O1 --------------------------

255.58user 0.02system 4:15.70elapsed 99%CPU (0avgtext+0avgdata 0maxresident)k
0inputs+0outputs (163major+22minor)pagefaults 0swaps
------------- g++ -O2 -----------------------------

461.92user 0.04system 7:42.23elapsed 99%CPU (0avgtext+0avgdata 0maxresident)k
0inputs+0outputs (203major+17minor)pagefaults 0swaps
------------ eg++ no optim --------------------------------

126.48user 0.00system 2:06.47elapsed 100%CPU (0avgtext+0avgdata 0maxresident)k
0inputs+0outputs (161major+17minor)pagefaults 0swaps
------------ eg++ -O1 ----------------------------

138.54user 0.03system 2:18.57elapsed 99%CPU (0avgtext+0avgdata 0maxresident)k
0inputs+0outputs (162major+17minor)pagefaults 0swaps
------------ eg++ -O2 -----------------------------

===========================================================================


I also compilied egcs on a PPro machine and created the static libraries
(the shared lib produces slightly slower code). The machine is an Intel
PPro 200Mhz, 64Mb EDO RAM, IDE HDD, running Slackware Linux, Kernel
2.0.30, libc.so.5.4.33, gcc-2.7.2.3, and the same egcs release as the K6
machine.  Surprisingly, the same code runs slower when run with the egcs's
g++ than with the gcc's g++ (esp. seen when the -O3 option is set). This
is totally in contrast to what is seen for the K6. I'd like to know why
this is happening. The output for the same source code on this machine is
given below the one for the K6.  I'd again like to know why? Do I need to
do some special optimisation or have a different setting? The output for
this machine is given below.


==================== Output for the PPro @200 Mhz=========================

163.76user 0.10system 2:44.40elapsed 99%CPU (0avgtext+0avgdata 0maxresident)k
0inputs+0outputs (157major+21minor)pagefaults 0swaps
------------- gcc with No optimisation ------------------

96.14user 0.05system 1:36.85elapsed 99%CPU (0avgtext+0avgdata 0maxresident)k
0inputs+0outputs (155major+21minor)pagefaults 0swaps
 ---------------- gcc with -O1 -----

76.66user 0.00system 1:16.84elapsed 99%CPU (0avgtext+0avgdata 0maxresident)k
0inputs+0outputs (155major+21minor)pagefaults 0swaps
-------------- with -O2 -----------------------------------------

76.70user 0.00system 1:16.86elapsed 99%CPU (0avgtext+0avgdata 0maxresident)k
0inputs+0outputs (155major+21minor)pagefaults 0swaps
---------- with -O3 -------------------------------------------

--------------- egcs's compiler comming up... -------------------------

152.12user 0.09system 2:32.91elapsed 99%CPU (0avgtext+0avgdata 0maxresident)k
0inputs+0outputs (117major+13minor)pagefaults 0swaps
------------ eg++ with no optimisation ----------------------------------

97.47user 0.00system 1:37.70elapsed 99%CPU (0avgtext+0avgdata 0maxresident)k
0inputs+0outputs (96major+13minor)pagefaults 0swaps
----------- eg++ with -O1  -------------------------------------------

95.93user 0.02system 1:36.15elapsed 99%CPU (0avgtext+0avgdata 0maxresident)k
0inputs+0outputs (96major+13minor)pagefaults 0swaps
----------- eg++ with -O2 ---------------------------------------------

95.80user 0.00system 1:35.86elapsed 99%CPU (0avgtext+0avgdata 0maxresident)k
0inputs+0outputs (96major+13minor)pagefaults 0swaps
----------- eg++ -O3 -----------------------------------------------

==============================================================================
	

	Hope this information is useful. I am not a member of this mailing
list. So...

I would also like to know when egcs will support namespaces. Is there a
stable snapshot/release that supports it? If so does it comply with the
ANSI-C++ standard? 

Thanks,
looking forward to hearing from someone,

Prabhu

------------------- Prabhu Ramachandran -----------------------------
E-mail:  prabhu@aero.iitm.ernet.in
Finger (for more info):  prabhu@www.aero.iitm.ernet.in
Home page:  http://www.aero.iitm.ernet.in/~prabhu
---------------------------------------------------------------------



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