19 April 2004

Code optimization

Newcomer has a very good essay on code optimization
In short:
1) The only valid path to optimization is by measuring the performance.
2) Be pragmatic, trivial performance gain doesn’t worth the risk of months work on complicated algorithm, danger of introducing new bugs and code maintenance difficulty.
3) Some looked ‘poor’ algorithm may have magnitude faster than ‘superior’ algorithm, depends on how a particular kernel works (memory paging, allocation method etc). Again, this will only known by benchmark.
4) Don’t bother with GUI code optimisation.

Executive summary: forget performance & optimisation as a developer.