Mail Archives: djgpp/2000/01/18/17:02:24
[ I wrote about weird optimization behaviour of gcc ]
>public available ones. I.e. my chess engine was about 20% slower
>when compiled with 2.8 versions of gcc, compared to gcc 2.7.3.
I actually meant 2.6.3 instead of 2.7.3
Eli suggested in an email reply, that I should show some
numbers.
My CPU is AMD K6-2 266.
Results are Nodes/sec for my chess-engine (reproducible to +/- 20)
There is virtually no time used in libraries. All sources are
plain C, not C++.
Test were run under msdos without windows loaded.
First an almost ancient version of gcc.
gcc 2.6.3: flags -fomit-frame-pointer -ffast-math + indicated flags
(the -ffast-math flag reall has no effect)
-On -m486
-O 98538 95302
-O2 100712 94826
-O3 85033 93219
Here the fastest seems to be -O2. When I still had my 486 running
-O -m486 was fastest, but almost equal to -O only. -O2 was slightly
slower.
gcc 2.9.2: flags -fomit-frame-pointer -ffast-math + indicated flags
-On -mcpu=k6 -On -march=k6
-O 86383 92070 92070
-O2 85852 86966 87009
-O3 81476 89791 89814
-O6 81421 89833 89818
In all three cases -O produces the fastest code. Whether I use
-mcpu=k6 (should produce optimized code for K6, while still
running on 386) or -march=k6 (may produce upcodes, that are
only available on K6) seems not to matter.
The produced code runs slower than code produced with gcc 2.6.3!
The same was true for my old 486 66 and 386SX when comparing
newer versions of gcc with 2.6.3.
I think, that the same results could be obtained on linux,
but I donīt have an old version of gcc for linux.
My conclusion is, to useally use -O only, and to still have
an old version of gcc around.
Regards,
Dieter
- Raw text -