Path: utzoo!utgpu!news-server.csri.toronto.edu!mailrus!uwm.edu!cs.utexas.edu!rice!rice!sun-spots-request From: robert@shangri-la.gatech.edu (Robert Viduya) Newsgroups: comp.sys.sun Subject: static/dynamic links: performance question Keywords: Miscellaneous Message-ID: <1990Jul31.030424.13585@rice.edu> Date: 30 Jul 90 15:57:32 GMT Sender: sun-spots-request@rice.edu Organization: Sun-Spots Lines: 23 Approved: Sun-Spots@rice.edu Originator: spots@titan.rice.edu X-Sun-Spots-Digest: Volume 9, Issue 287, message 10 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