Peter Olcott wrote:
The main thing that I am looking for is rules-of-thumb
that maximize the execution speed of time critical
applications.
Memory-performance and runtime-performance are different things, usually
in direct opposition to each-other, since you can often trade memory and
runtime by using dynamic-programming (caching).
Use a profiler. Do *not* fall into the pit of micro-optimizing.
For performance-profiling, use a performance-profiler, like nprof or one
of the many available commercially. For memory profiling you can use the
rather neat CLRProfiler. Both can be found using google, now you know
the names.
If all else fail, you will need to look at the optimized JIT code
resulting from running the program to identify *what* is taking all
those CPU-seconds, don't expect to shave any real amount of CPU-time if
you are at this level. You can rewrite to minimize cast-checks,
index-checks and virtual-calls, but there's not too much to be gained here.
And, here is the BONUS rant :)
The most valuable resource in programming today is *developer-time*. So
you should probably look into how you can obtain low development-time
with acceptable runtime performance and memory consumption.
I have found that some of the best ways to reduce developer-time are:
- Solve the job at hand, not a generalized instance. You can *always*
generalize later. If your "process" prevents this, change your process.
- Identify the domain that your application/library should express,
and make the structure of your programming precisely reflect that. If a
design/architecture prevents this, change it, or secondly write an
adapter that fits into the design/architecture separatly.
- Code lazy. Always take the easiest solution to a problem, untill it
is verified (almost always by a profiler) that this code is the
performance-culprit.
- Constantly talk to whomever is your "customer", the one who you
deliver to, they may unspoken have input, you may have to make them
change their mind about what they want, and (very often) you
misunderstood eachother.
--
Helge Jensen
mailto:he**********@slog.dk
sip:he**********@slog.dk
-=> Sebastian cover-music:
http://ungdomshus.nu <=-