Next | Making Programs Faster | 35 |
A program is taking too long to run
We want to speed it up
First figure out if it is CPU-bound, memory-bound, or I/O bound
Or possibly some of each
If CPU-bound, use a profiler to find CPU-bound parts of the program
Then think hard about just those parts
Come up with a plausible improvement
Test the 'improved' version to make sure it does the same thing
Time the 'improved' version against the original
If the new version is faster, weigh the benefit against the costs
For example, is the code more complicated now?
If so, is it worth it?
Throughout, try to estimate whether it wouldn't be cheaper in the long run to just buy more hardware
Next | Copyright © 2003 M. J. Dominus |