Efficiency Question

Chris Torek torek at elf.ee.lbl.gov
Tue Feb 26 06:53:06 AEST 1991


In article <4bmBqau00Uh_M0aHgb at andrew.cmu.edu> rg2c+ at andrew.cmu.edu
(Robert Nelson Gasch) writes:
>The basic question I have is this: Since what you are doing (in each
>case) remains basically the same, do such contractions have an impact on
>the resulting code in terms of size and/or speed?

See the preceding discussion on `micro-optimizing loops'.

Generally, if the compiler is worth what you paid for it, source
transformations such as:

	x = x + 1		=>	x++
and
	for (x++; t[x]; x++)	=>	while (t[++x])

make no difference whatsoever, so use the one that is most readable.

Note that, to some extent, making something shorter makes it more
readable.  Taken to an extreme, however, it has the opposite effect.
Readability resides in the mind of the reader; preferences will differ.
-- 
In-Real-Life: Chris Torek, Lawrence Berkeley Lab EE div (+1 415 486 5427)
Berkeley, CA		Domain:	torek at ee.lbl.gov



More information about the Comp.lang.c mailing list