Efficiency Question

Garry Garrett garry at ceco.ceco.com
Sat Mar 2 11:14:54 AEST 1991


In article <1991Mar1.014046.20503 at isis.cs.du.edu>, ebergman at isis.cs.du.edu (Eric Bergman-Terrell) writes:
> 
> Back when I was programming C on a PDP-11 many of those C shortcuts
> (esp. pre & post increment) often did result in smaller and faster code.
> 
> I expect that as optimizing compilers improve, semantically equivalent
> blocks of code will tend to result in the same sequence of machine
> instructions.
> 
> Terrell


	Admittiedly, most of my shortcuts are desiged to make good use of
the registers.  It is not as important on newer machines because they have
more registers, and often the optimizer can fit several variables into 
registers for you.  There is not cut and dried best answer as some of us
out here still are programming on older machines.  (I too first learned 
C on a PDP-11, where these optimizations made a big difference.  Try programming
on a Z80 driven machine - 3 registers, including the program counter and stack
pointer.)

	All comments about speed should be taken with a grain of salt (and
presumed to have a "On my machine" appened to the front of them).



More information about the Comp.lang.c mailing list