If your software runs, but it is too slow or uses too much memory, you need optimization services. I can turn your big programs into smaller ones.
Too Much Time/Too Much Energy
Once upon a time in a land far, far away, computer clock speeds doubled every eighteen months. Every program got faster and faster, and every user was happy. The end.
This little fairy tale has come to an end in more ways than one. Program functionality has grown apace with processor speed, and processor clock speeds are no longer increasing due to the "power wall" - further increases in speed come at huge costs in power consumption.
The rise of mobile computing - smartphones and tablets - has raised another issue: faster code is necessary to keep the system running all day without recharging.
So despite decades of processor speed improvements, runtime optimization is still important. There are a number of ways, obvious or subtle, to improve the runtime of a program. Here are some examples, starting with ways that tend to yield the biggest "bang for the buck:"
- Look for inefficient loops that need O(n2) or worse (perhaps even exponential) runtime;
- Precompute results and move their computation out of loops;
- Store past results for reuse (caching);
- Use better data structures to reduce the need to perform expensive operations;
- Write special-purpose code for common cases;
- Compute approximate results rather than exact answers; and
- Rewrite modules to use more-efficient algorithms.
Each of these techniques has served me well at least once in the more than 1,300,000 lines of code I've written.
Runtime optimization often increases the complexity of the code. It is important not to optimize too early - "make it right before you make it fast." When you are ready to make it fast, I can help.
Too Much Memory
Once upon a time in a land far, far away, memory was free. Every program had all of the space it needed, and every user was happy. The end.
This little fairy tale is almost true - memory costs have continued to drop exponentially, and the amount of memory in the largest computer systems has continued to grow. However, there are always programs that bump up against practical limits on memory usage.
To minimize cost, embedded systems often have very little memory. Engineering design software usually runs on top-of-the-line hardware, but design of complex systems can require every byte of memory in the computer. Data analytics software typically works on huge unstructured data sets.
When I started writing software, even the biggest computer systems had memory measured in kilobytes or megabytes. Reducing memory consumption has been critical for most of my career, and I have a full bag of tricks to apply to reduce memory usage in your applications:
- Recompute results rather than store them;
- Eliminate rarely used data fields and data structures;
- Fold sparse data structures and lookup tables;
- Use custom memory management techniques; and
- Spill data to mass storage.
Of course, some of these methods increase runtime, so they too must be used judiciously. "Make it right, then make it small." It is even possible that a program could have both runtime and memory usage problems, so the best solution must be determined experimentally. My experience will help you reach this point quickly.