Well-structured programs are easier to optimize than poorly-structured ones. If we grow a program as a collection of functions, refactoring along the way, we will be able to change those functions more or less independently of one another to try out new ideas. As is almost always the case, improving the quality of our work improves our performance: it is the opposite of an either/or tradeoff. In addition, choosing the right algorithms and data structures often yields bigger speedups than switching to parallel hardware, so we should always look there first for performance gains.

  • Build programs top-down: write as if the mini-language you wanted already existed, them go back and fill in the missing pieces.
  • Modular programs are easier to test and refactor than ones with many dependencies between components.
  • Careful choice of algorithms and data structures often produces bigger performance improvements than parallel hardware possibly could.

Introduction

The Grid

Aliasing

Randomness

Neighbors

Handling Ties

Assembly

Bugs

Refactoring

Testing

Tuning

comments powered by Disqus