Optimising Speed 2 (time)
Strip asserts and other instrumentation for release
Push work to other/bigger machines
Pick unbalanced algorithms harder on server, easier on embedded system
Minimise heap use: it is still slow!
Reduce interface crossing such as in OS calls: usually slow.
Avoid cache-unfriendly stride and indirection
Get thread (and interrupt) priorities right
Notes:
EXAMPLE: Assert stripping (and eliminating debug support) typically halves size of many applications.
- Are you sure that your asserts don’t have side-effects that will break your program when stripped? They should never have any side effect other than to stop the application immediately if something is manifestly wrong.
- When handling significant quantities of data in arrays, in C/C++/Java increment the rightmost index in the inner loop.
- Are you copying data you can avoid? Early OS implementations wasted more than half their CPU cycles copying.
- Are you getting thread priorities right? Avoid starvation. Make sure User Interface and other real-time activity including I/O gets handled promptly.