Array indexing vs. pointers...

Robert W Berry rwberry at hubcap.UUCP
Sat Oct 1 00:29:11 AEST 1988


>From article <836 at proxftl.UUCP>, by bill at proxftl.UUCP (T. William Wells):
> In article <607 at ardent.UUCP> mec at ardent.UUCP (Michael Chastain) writes:
> : Good grief.  Say NO to low-level performance tweaking.
> ...
> At one time, I spent a lot of my spare time improving other
> people's code.  One of the things I discovered is that almost all
> the code I was dealing with had better than 25% execution time
> fat.  What I mean is that when I merely changed all of the code
> to follow my coding practices (which are not anything special,
> just obvious things that every coder ought to know), it got that
> ...
> Now, let us compare these: if the programmer had trained himself
> to code my way, he could have written the program to be 25%
> faster *with no additional effort*.  Or, he could have it 45%
> better doing it the original way, after all the additional effort
> to optimize that 10% (if we are being optimistic, that is).
> 
> If he were to spend that extra effort on the code that follows my
> practices, the resultant code would be 59% faster.
> 
> The point of all this is that learning coding practices that

    I've been programming for YEARS, and if it's not a professional trade
secret, I'd love it if you would summarize your "coding practices" and
email them or post them.  If you can get half the added efficiency
you're talking about, the programming practices be would of interest to the
whole computing world.  Like you I spend a great deal of my time
optimizing code for other people, and I have yet to see more than a
20-25% improvment (even over BAD code.)  
                *** THIS IS NOT A FLAME OF ANY KIND ***
I would sincerely like to see these practices.  They might give me a new
outlook on coding.

BTW the way I believe that the 90-10 proposition includes OS overhead,
and thus it becomes a much more possible figure.  (ie  It is really the
OS that forms most of that 10%  Depending on the complexity of your OS
this may often be close to the case.)
I do agree on your views of personal preference.  Some people just THINK
in terms of pointers.  For these people writing code with array indexing
would be nearly as comfusing as a person who thinks in array indexing
trying to write code with pointers. 

Looking forward to hearing more,
Bob

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
-=- Bob Berry -=- PC-Guru's Inc. ! INTERNET:rwberry at hubcap.clemson.edu  -=-
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=   ! BITNET:rwberry at clemson               -=-
-=- This space for rent or lease ! Compuserver:72646,3331 or 73170,1242 -=-
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-



More information about the Comp.lang.c mailing list