Array indexing vs. pointers...

Barnacle Wes wes at obie.UUCP
Fri Oct 7 13:10:58 AEST 1988


In article <225800077 at uxe.cso.uiuc.edu>, mcdonald at uxe.cso.uiuc.edu gives
six good, fairly detailed tips for optimizing C programs.  One thing to
keep in mind here is that in general, you are wasting your time trying
to optimize the entire program.  Most programs spend a large amount of
their processing time in a few critical routines.

The way to conquer this problem, and not waste a lot of valuable time
optimizing the current program, when you could be adding features to the
next version :-), is to profile your code.  Find out which routines the
program spend most of it's time in, and then optimize THOSE routines.
If you spend 3 weeks getting this one routine to run in 350
milliseconds, as opposed to 1 second, you have just wasted 3 weeks if
that routine is only executed once every third or fourth time the user
uses the program.

-- 
                     {hpda, uwmcsd1}!sp7040!obie!wes

         "How do you make the boat go when there's no wind?"
                                 -- Me --



More information about the Comp.lang.c mailing list