Find us on GitHub

Teaching basic lab skills
for research computing

Program Design

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.
  1. Introduction
  2. The Grid
  3. Aliasing
  4. Randomness
  5. Neighbors
  6. Handling Ties
  7. Assembly
  8. Bugs
  9. Refactoring
  10. Testing
  11. Tuning