GCC, EGCS and PGCC comparisson

New I'm arranging some new data, it includes results from 26 different compilations tested on a K6-2 300 MHz and a Pentium MMX 233 MHz. I'll need some weeks before I can replace the old values by the new ones, but I also included an analisys of the assembler generated by gcc compared with the one generated by MSVC that is very interesting.
I think anybody involved in the gcc optimization should read it.

The "Linux Game Development Center" people did a re-arrangement of the data presented here taking MSVC compiler as reference, you can find it in: http://sunsite.auc.dk/linuxgames/articles/tropea_compilers.html .

At first I must say this comparisson isn't very accurate but is just yet another value to take in count.
I used the BYTE benchmarks, the C sources says: "BYTEmark (tm) BYTE MAGAZINE'S NATIVE MODE BENCHMARKS FOR CPU/FPU ver 2.0 Rick Grehan, BYTE Magazine". They are supposed to be portable and report values with some meaning, not just numbers ;-).
The benchmarks are just some very well known algorithms implemented by the BYTE people. I think they are a little bit adjusted for Watcom compilers but they are ok.
I used an AMD K6 266 MHz computer so the values in an Intel CPU could be different but I think they will be very similar.
All the test were performed under Wincrap 95 using djgpp compiler.
The tables are very wide, I don't know a simple way to solve it.

Obtained values

Operation\Compilergcc 2.8.0 No optimizations (3)gcc 2.8.0 -O2 (3)gcc 2.8.0 -O3 (1)(3)gcc 2.8.0 -O3 (1)(2)(3)egcs 1.1a -O3 (1)(4)egcs 1.1a -O3 (1)(2)(4)pgcc 2.90.23 (egcs 1.0.1) -O3 (1)(4)pgcc 2.90.23 (egcs 1.0.1) -O6 (1)(4)(5)egcs 1.1.1 -O2 (2)(6)egcs 1.1.1 -O3 (1)(2)(6)egcs 1.1.1 -O3 (1)(6)Visual C++ 5.0Watcom 10.0a
NUMERIC SORT:50.158649138.177184138.810736142.027848139.839147139.346933137.813019125.974885139.437737123.297358125.473971153.228628125.781775
STRING SORT:7.73769.2512769.270439.3095449.2512769.2129689.0264659.1942058.9367419.1574749.19459616.24866212.723533
BITFIELD:11160540.0826483635.1326449374.6726483924.6925654847.5127396247.3322017659.4722793551.4722793335.5327342117.7527397278.6135894514.2424903701.78
FP EMULATION:3.872346.6788997.5676987.6631587.6957677.9826098.4815538.8962776.48.1644867.9826096.5738616.069806
FOURIER:2539.8423562390.3519292579.2860122519.129122357.9165222387.8372822342.6263162444.4490312300.5732792361.2592212346.9572852857.2544742269.467655
ASSIGNMENT:0.6476991.2921741.1870131.0520781.3788271.1052811.0581951.2539661.1008691.0921.3384391.9592490.803368
IDEA:150.046946198.290958245.006726206.823983241.724272201.030324215.389633272.289808150.046946204.172272236.753824256.719471249.36021
HUFFMAN:50.091743109.861818120.266667123.451456123.213592122.033333132.99348130.005415122.5122.033333119.73913173.959603168.270136
NEURAL NET:0.4565291.5826091.61.5655911.3439061.3818051.639641.4274511.1281191.3270831.2921211.2953751.338978
LU DECOMPOSITION:13.72870530.77755830.830.09634234.406433.629.8934.46234135.54905933.22274934.33995949.90019840.634605
INTEGER INDEX:1.9907433.7091473.8978913.7756783.9835183.8052393.7630783.9800563.4296793.7488863.9318754.9989143.842807
FLOATING-POINT INDEX:1.2165722.361512.4315872.3767352.3103562.3232552.3504942.3870542.1852772.2750592.2752872.7541112.408228

Note: Even when nobody asked, and I got more than 150 hits in less than 24 hs. and three comments, the values here are iteration/second. It means that greater is better.

Normalized values, the reference is the Watcom version

Note: Mark Potter teach me that arithmetic averages can generate wrong results and that some people use them to fool others so here I use a better methode.

Operation\Compilergcc 2.8.0 No optimizations (3)gcc 2.8.0 -O2 (3)gcc 2.8.0 -O3 (1)(3)gcc 2.8.0 -O3 (1)(2)(3)egcs 1.1a -O3 (1)(4)egcs 1.1a -O3 (1)(2)(4)pgcc 2.90.23 (egcs 1.0.1) -O3 (1)(4)pgcc 2.90.23 (egcs 1.0.1) -O6 (1)(4)(5)egcs 1.1.1 -O2 (2)(6)egcs 1.1.1 -O3 (1)(2)(6)egcs 1.1.1 -O3 (1)(6)Visual C++ 5.0Watcom 10.0a
NUMERIC SORT:0.3987751721.098546941.1035838541.1291607871.1117600071.1078467691.0956517271.0015352781.1085686860.9802481960.9975528731.2182100941
STRING SORT:0.6081329770.7270996190.7286050190.7316791650.7270996190.724088820.7094307060.7226141510.7023788910.7197272960.7226448821.277055831
BITFIELD:0.4481478371.0634417071.0620659891.0634533341.0301620111.1000873520.8841119150.9152676050.9152589341.0979137961.1001287621.441332481
FP EMULATION:0.6379676711.1003480181.2467775741.2625046011.267876931.3151341251.3973351041.4656608461.0543994321.3450983441.3151341251.0830430171
FOURIER:1.1191357371.0532654761.1365158721.1100088231.0389733981.0521574421.0322360451.0771023881.0137061321.0404462981.0341444081.2589976631
ASSIGNMENT:0.8062295241.6084459431.4775457821.3095841511.7163080931.3758090941.3171983451.5608861691.3703172151.3592774421.6660347442.4387939281
IDEA:0.6017277010.7951988730.9825413850.8294185470.9693778810.8061844510.8637690551.0919537160.6017277010.8187844890.9494450781.0295125711
HUFFMAN:0.2976864710.6528895780.7147237760.733650420.7322368360.7252227630.7903570010.7725994530.7279960840.7252227630.7115887161.0338115081
NEURAL NET:0.3409533241.1819529521.1949412161.1692432591.0036804191.0319848421.2245458851.0660750210.8425224310.9911163590.96500540.9674356111
LU DECOMPOSITION:0.3378574740.757422350.7579746380.740657920.8467265770.8268814230.7355799320.8481032610.8748469190.8175974390.8450914931.2280222241
INTEGER INDEX:0.5180439720.9652181341.0143343130.9825312591.0366167230.9902238130.9792524061.0357158190.892493170.9755592721.0231778491.3008496131
FLOATING-POINT INDEX:0.5051730980.9806006741.0096996630.986922750.959359330.964715550.9760263560.9912076430.9074211410.9447024950.944797171.1436255211
Product:0.001290850.7359603311.1372206280.8497147991.1357182250.838166040.8028721641.2450237610.337022560.7090213060.9900839859.4285150611
Geometric average:0.5141473080.9698072821.0129417530.9838464391.0128078520.9825010110.97828331.0221573690.8969451740.9661975430.9990039461.2515388341
Same in percent:51.41%96.98%101.29%98.38%101.28%98.25%97.83%102.22%89.69%96.62%99.90%125.15%100.00%

Graphics:

All in one it contains all the data, is hard to use but you can see the weak and strong points of GNU compilers.
Integer and floating point indexes it contains the geometric averages of the integer and floating point test separated.
Overall it contains the geometric averages of all the tests.

References:

(1) -fomit-frame-pointer -ffast-math
(2) -mcpu=i586 -march=i586
(3) djgpp v2.01 and binutils 2.8.1
(4) djgpp v2.02 (981115) binutils 2.9.1
(5) -mcpu=amdk6 -march=amdk6
(6) djgpp v2.02 release and binutils 2.9.1

My conclusions:

Even when particular algorithms are benefited by some compiler the whole suite of benchmarks gives almost the same values when we add the partial results giving the same weight to each test.
The only compiler that gives better performance is the Microsoft VC++ 5.0. This compiler is really well fine tuned for Pentium processors. It doesn't surprise me because BYTE compared compilers from Symantec, Borland, Watcom (too versions), Intel and Microsoft in january of 1998. My results are the same. GCC is better than Borland 5.02 and Symantec 7.5 (the worst); is comparable to Watcom 10 and 11 and is worst than Intel 2.4 and Microsoft 5.0.
Is interesting the result of gcc without optimizations, it gets about half of the points.
Basically all the compilers performed OK and with almost no difference. The best for overall was the fine tunned pgcc using -O6 and specifying AMD K6 as target. But even in this case the result was less than 5% better than Watcom. Even comparing the best case with the worst (gcc -O2) the difference is under 5%.
The conclusion is that for non-specific uses all are almost the same. In fact gcc 2.8.0 using -O3 performs very well in Pentium processors.
I think the weak point of gcc is the use of registers as parameters. This task is done very well by Watcom's compiler and with GNU compilers is something the programmer must do by hand making it impossible to use.
BTW according to this benchmark the K6 266 is a 345.6 MHz Pentium for integers and a 216.72 MHz Pentium for FPU.

Visited since December 2, 1998: Counter

Copyright © 1998,1999 by Salvador E. Tropea.
If you want to use these values for some publication just let me know.
HTML created with Setedit, my own text editor ;-). The macros, column operations, regular expressions search & replace, etc. helped a lot.
1