Mail Archives: djgpp/1997/09/17/15:00:26
I made some tests between watcom and djgpp yesterday
I had tried djgpp a long time ago, and it was generating slow code in
comparison of the watcom, but as it was a long time ago, I made a comparison
between the last version of djgpp (at least the one at DJ Delorie's page
(btw rhide fails on my computer :) ) and the Watcom 11 beta version
I used them with max optimisations :
watcom : /fpi87 /fp5 /oaeil+mnprt /s /mf/d1 /bt=dos4g /zdp /zq /5r /fhq /zu
djgpp : -O2 -m486 -fomit-frame-pointer -ffast-math -funroll-loops
I made a very simple program which had 4 arrays of 1000 ints, fill them with
random values
the timing start from there : (arrays being a,b,c,d)
for(t=0;t<count;t++) a[t%1000]=b[c [ d[t%200]%500]%1000];
this wasn't exactly this function, but it was like this :)
count IS a constant, so the compiler can safely unroll loops
the timing takes in account the above function ONLY, not the inits, calls to
the lib, etc
I compiled, timed and also looked at the generated code.
the unrolling loop function of djgpp is much more intelligent that the
watcom's (which unrolls loops only if there's a very low count). djgpp
unrolled the loop 10 times
on this test djgpp gave a faster execution (like 17 seconds) than the watcom
(about 20)
the code generated by both compiler were very close, the most noticeable
difference was the loop unrolling
I tried to make another program which was taking the counter%10 and made a
switch and ten case, each case was just a simple math (add,sub,mul,div) like
4 or 5 operations per case
the watcom seemed to have generated clever code this time, but this wasn't
noticeable on the execution. maybe after one or several minutes we may have
seen a difference due to a few clocks per iteration
then made a function like the first one, but with heavier maths in it
(result were multiplicated, divided, etc by other arrays' values, etc).
djgpp was the fastest too by 2-3 seconds out of twenty.
I also took all the previous tests and changed everything to floats (with
(int) casts before each array to run the first one) and this time.... the
watcom blown away djgpp with no possible comparison : 6 times faster !
BUT the watcom has pentium-fpu optimization which is not known to djgpp
I'll continue my tests, it seems that djgpp has improved a lot since my
first test. but the gcc I've with my linux (slackware 2.0.0) SUUUUUUUCKS, it
generates the worst code I've ever seen, maybe there's a newer version ?
(please tell me)
I'll make more complete tests and publish both results and source code, so
we'll be able to establish comparisons with msvc and bc++ too.
- Raw text -