robert@shangri-la.gatech.edu (Robert Viduya) (07/30/90)
A friend of mine has noticed a slighty disturbing behaviour with SunOS 4.1
on SS1's and 1+'s. He was benchmarking the machine using the Dhrystone
program and, well, see for yourselves:
$ cc -O4 -DREG=register dry.c -o dryr; dryr
Dhrystone(1.1) time for 250000 passes = 13
This machine benchmarks at 18844 dhrystones/second
$ cc -Bstatic -O4 -DREG=register dry.c -o dryr; dryr
Dhrystone(1.1) time for 250000 passes = 11
This machine benchmarks at 22058 dhrystones/second
The only difference between the two runs is that the second one is linked
statically. The result is a 17% speedup. He suspects the static and
dynamic libraries are different. At first, I thought it might be the
global optimizer being able to do a better job when linking statically,
but when I compiled with -O1, I still got a 15% speedup on static links.
(Further investigation shows that Sun's global optimizer only works on a
single source file basis; it doesn't optimize across multiple source
files.) Can anyone explain what's going on here? Are the libraries
different or do dynamic links really cost that much?
Robert Viduya robert@shangri-la.gatech.edu"Mark_Weiser.PARC"@xerox.com (08/03/90)
The dynamic libraries are indeed different from the static libraries, because they must use position independent code. See the -pic flag to cc. I'm a little surprised at this large a difference, which must probably be in the string library routines given Dhrystone's profile.