Path: utzoo!utgpu!news-server.csri.toronto.edu!bonnie.concordia.ca!thunder.mcrcim.mcgill.edu!snorkelwacker.mit.edu!shelby!agate!ucbvax!dog.ee.lbl.gov!elf.ee.lbl.gov!torek From: torek@elf.ee.lbl.gov (Chris Torek) Newsgroups: comp.lang.c Subject: Re: Efficiency Question Message-ID: <10254@dog.ee.lbl.gov> Date: 25 Feb 91 19:53:06 GMT References: <4bmBqau00Uh_M0aHgb@andrew.cmu.edu> Reply-To: torek@elf.ee.lbl.gov (Chris Torek) Organization: Lawrence Berkeley Laboratory, Berkeley Lines: 23 X-Local-Date: Mon, 25 Feb 91 11:53:07 PST In article <4bmBqau00Uh_M0aHgb@andrew.cmu.edu> rg2c+@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@ee.lbl.gov