Article View: comp.lang.misc
Article #6685Re: Common subexpression optimization
From: Chris Siebenmann
Date: Thu, 08 Feb 1990 21:38
Date: Thu, 08 Feb 1990 21:38
30 lines
2000 bytes
2000 bytes
brnstnd@stealth.acf.nyu.edu (Dan Bernstein) writes:
| When efficiency is important, write out the expressions. If the
| efficient version is different on different machines, write it out
| separately for each. There is a limit to what the compiler can
| optimize; a competent programmer assumes merely that the compiler
| understands scheduling and register allocation, and does the rest of
| the job by hand.
I would say instead that a competent programmer would first get it
correct, then measure things to see whether or not you need to speend
them up, and then look at the various mechanisms for doing so. Always
know where your bottlenecks are; it makes little sense to shave
milliseconds off a loop when every iteration spends half a second
doing a system call.
It's true that the compiler system can do noticably better with hints
of some sort from the user. However, there is little need for these
hints to be "register" declarations and unrolled expressions and so
on; feed the compiler system profile run output instead (see, for
example, the DECWRL paper(s) on link-time register allocation,
especially the one that compares it to register windows).
Does anyone have numbers or hard information on the quality of
current compilers (especially C compilers) and how much one can
improve things by tweaking the source code?
--
"I shall clasp my hands together and bow to the corners of the world."
Number Ten Ox, "Bridge of Birds"
cks@white.toronto.edu ...!{utgpu,utzoo,watmath}!utcsri!white!cks
Technical Details
Message-ID:
<1990Feb8.163846.18094@jarvis.csri.toronto.edu>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!white.toronto.edu!cksReferences:
<4561@scolex.sco.COM> <14214@lambda.UUCP> <PCG.90Jan29131938@rupert.cs.aber.ac.uk> <2217@sunset.MATH.UCLA.EDU> <838.18:06:33@stealth.acf.nyu.edu>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!white.toronto.edu!cks Newsgroups: comp.lang.misc From: cks@white.toronto.edu (Chris Siebenmann) Subject: Re: Common subexpression optimization Message-ID: <1990Feb8.163846.18094@jarvis.csri.toronto.edu> References: <4561@scolex.sco.COM> <14214@lambda.UUCP> <PCG.90Jan29131938@rupert.cs.aber.ac.uk> <2217@sunset.MATH.UCLA.EDU> <838.18:06:33@stealth.acf.nyu.edu> Date: 8 Feb 90 21:38:46 GMT Lines: 30