Newsgroups: | comp.compilers |
From: | dan@kfw.com (Dan Mick) |
References: | <1990Jun12.163959.2593@esegue.segue.boston.ma.us> <1990Jun13.143951.2129@esegue.segue.boston.ma.us> <1990Jun15.051349.3016@esegue.segue.boston.ma.us> |
Date: | Wed, 20 Jun 90 04:11:49 GMT |
Organization: | KFW Corporation, Newbury Park, CA |
Keywords: | code, optimize |
In article <1990Jun15.051349.3016@esegue.segue.boston.ma.us> pardo@june.cs.washington.edu (David Keppel) writes:
[speaking of *s++ = *p++ vs s[i] = p[i++]]
>A moment's consideration should (hopefully) convince
>you that the first form requires two increments per iteration, while the
>latter requires only one. The only case when the first is cheaper is when
>two pointer increments are cheaper than one integer increment. The point
>being that pointer arith. isn't always a win.
erm. I'm sure you realize, by now, that you also have two in-the-loop adds,
that may or may not be covered by a machine instruction, and that may or
may not be faster than the pointer adds, anyway. Don't forget that
[] is an add, no matter how you slice (or notate) it.
--
Return to the
comp.compilers page.
Search the
comp.compilers archives again.