Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uunet!ceco!garry From: garry@ceco.ceco.com (Garry Garrett) Newsgroups: comp.lang.c Subject: Re: Efficiency Question Message-ID: <422@ceco.ceco.com> Date: 2 Mar 91 00:14:54 GMT References: <4bmBqau00Uh_M0aHgb@andrew.cmu.edu> <1991Mar1.014046.20503@isis.cs.du.edu> Organization: Commonwealth Edison Co., Chicago, IL Lines: 23 In article <1991Mar1.014046.20503@isis.cs.du.edu>, ebergman@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).