Article View: sci.image.processing
Article #316Re: image processing loops
From: Rodney Radford
Date: Wed, 12 Aug 1992 02:27
Date: Wed, 12 Aug 1992 02:27
38 lines
2453 bytes
2453 bytes
jarreau@vuse.vanderbilt.edu (Michael P. Jarreau) writes: >The speed increase comes from the fact that there is a single machine >instruction which is something to the effect of "decrement register >and jump to address xxx IF NOT ZERO" thus costing one machine cycle. But unless you have a zero-instruction body, the extra few cycles saved by changing increments to decrements can't be that much of a total percentage change in CPU time (and if it really were, wouldn't this be an easy optimization for a good optimizing compiler?). >Other speed optimizations can be made by avoiding comparisons which >contain expressions. These expressions are re-evaluated at each >iteration of a loop without regard to whether any of the concerned >variables have changed. Again this seems like something that any decent optimizing compiler could take care of. Moving loop independent expressions outside of a loop has been common practice for several years now. Which compiler are you using and do you have the optimizer enabled? >I expect that this holds true with other processors, I just don't have >any recent experience on them. The above type of micro-optimizations used to be common practice when writing effiecent C programs, but with the advent of optimizing compilers it is usually best for the programmer to spend their time with macro- optimizations such as better algorithms and leave the low-level type of operations to the compiler writers. If you are finding that you MUST micro-optimize your C code to get the performance you desire, then I would take it up as a problem with your C compiler vendor. -- --- Rodney Radford || Computer Graphics/Imaging sasrer@unx.sas.com || SAS Institute, Inc. (919) 677-8000 x7703 || Cary, NC 27513
Technical Details
Message-ID:
<sasrer.713586462@cinnamon>Path:
arc1-ca.pugleaf.net!sparky!uunet!elroy.jpl.nasa.gov!ames!agate!stanford.edu!rock!concert!sas!mozart.unx.sas.com!sasrerReferences:
<1992Aug10.221247.8016@cfa.harvard.edu> <1992Aug11.151146.11849@vuse.vanderbilt.edu> <Bsu0zo.6qC@acsu.buffalo.edu> <1992Aug11.200012.24819@vuse.vanderbilt.edu>Show Full Headers
Complete Article Headers
Newsgroups: sci.image.processing Path: arc1-ca.pugleaf.net!sparky!uunet!elroy.jpl.nasa.gov!ames!agate!stanford.edu!rock!concert!sas!mozart.unx.sas.com!sasrer From: sasrer@unx.sas.com (Rodney Radford) Subject: Re: image processing loops Sender: news@unx.sas.com (Noter of Newsworthy Events) Message-ID: <sasrer.713586462@cinnamon> Date: Wed, 12 Aug 1992 02:27:42 GMT Distribution: sci.image.processing References: <1992Aug10.221247.8016@cfa.harvard.edu> <1992Aug11.151146.11849@vuse.vanderbilt.edu> <Bsu0zo.6qC@acsu.buffalo.edu> <1992Aug11.200012.24819@vuse.vanderbilt.edu> Nntp-Posting-Host: cinnamon.unx.sas.com Organization: SAS Institute Inc. Lines: 39