[comp.compilers] Unisoft C Compiler for A/UX -- dhrystone and -O

jim@jagmac2.gsfc.nasa.gov (Jim Jagielski) (07/06/90)

I have Unisoft's Optimizing C Compiler for A/UX (gcc -- NOT gnu cc) and
have noticed something strange.

When compiling the dhrystone benchmark, I get faster performance from the
non-optimized binary as compared to the optimized version. The difference
is small (~12000 vs ~11700, with maximum of ~12444 without opt. and a
min of ~11500 with opt.) but there. Doing other benchmarks, esp. with
floats and doubles, performance is expected (i.e., -O results in quicker
code, but a little bigger) but this discrepency in dhrystones is
interesting...

Anyone else have any experience with Unisoft or a similar occurance?
--
           Jim Jagielski                    NASA/GSFC, Code 711.1
     jim@jagmac2.gsfc.nasa.gov               Greenbelt, MD 20771
[Given that the instructions for Dhrystone tell you not to use a global
optimizer, I wouldn't rule out the possibility that this is yet another
compiler tweaked to make Dhrystone run fast. -John]
-- 
Send compilers articles to compilers@esegue.segue.boston.ma.us
{spdcc | ima | lotus| world}!esegue.  Meta-mail to compilers-request@esegue.

mike@hpfcso.HP.COM (Mike McNelly) (07/20/90)

If I remember correctly, the original Dhrystone benchmark timed a null
loop to determine loop overhead and then a similar useful loop.  Timing
was at least in part reported as a ratio between the two.

Now if the optimizing compiler is smart enough to see that the original
timing loop is completely useless it may reduce the loop or even
eliminate it entirely but not eliminate the same parts from the other
one that does useful things.  Voila, you have a bogus ratio.

Check to see if this is the case in the source code.  If it is, then a
better way to see if the optimizer is actually improving code is to time
the whole benchmark externally via a time() call from the shell or
something like that.

Several benchmarks I've seen demonstrate this phenomena.

Mike McNelly
mike@hpfcla
-- 
Send compilers articles to compilers@esegue.segue.boston.ma.us
{spdcc | ima | lotus| world}!esegue.  Meta-mail to compilers-request@esegue.