< Day Day Up > |
Jerry Weinberg tells the story of two groups, both working on solving the same problem. Jerry's group created a solution that worked correctly but was slower than the other group's. The other group developed a solution that was fast but did not work for all input values. The other group leader referred to the differences by belittling the correct solution for running so slowly. Jerry replied by asking when the other group would have a usable solution. It is usually easier to transform a correctly designed "slow" system into a fast enough system than it is to alter an incorrect fast system. Even if the slow system cannot be transformed, it can be used as a reference platform for functionality tests. [*]
Do not waste time making assumptions about performance. Use a profiler to measure performance so that you can focus on a handful of key bottlenecks. Jim Batterson, a fellow consultant, tells the story:
Once you have determined the location of the bottleneck, you can create a solution. Selecting a different algorithm often yields the greatest performance gains. For example, a quicksort algorithm works better than a bubble sort most of the time. With object-oriented programs, high levels of abstraction can be the cause of bottlenecks. Fewer layers of abstraction decrease the number of method calls and thus the calling overhead. Sometimes more tightly coupled objects can eliminate overhead (e.g., sending messages in internal format between computer systems, instead of in a standard text format).
|
< Day Day Up > |