Aaron Welch

read/reading: the optimisation bits in the dragon book (not as much as I'd hoped for, but the implementation of the optimisations might give some extra insight…maybe…so I'm going back and checking them out)
currently reading: Design of Compilers: Techniques of Programming Language Translation (it also has a section for optimisation)
reading next (?): Parallel Programming and Compilers by Constantine D. Polychronopoulos (it's got a few short sections on more general forms of optimisation, as well as almost certainly containing information relevant to what open64 might be doing with -apo to some of the dummy progs…besides, the book is AWESOME)

list of optimisations:

  • sequential vs nonsequential indexing of arrays (arr[i][j] vs arr[j][i])
  • bitshifting vs integer arithmetic
  • prefix vs postfix increments and decrements for objects
  • prefix ps postfix increments and decrements for primitives (uninteresting/invalid?)
  • +, -, … operators vs +=, -=, … operators for objects
  • +, -, … operators vs +=, -=, … operators for primitives (uninteresting?)
  • bitwise vs boolean operators for checking multiple values
  • table lookup vs recalculation (eg trigonometric precomputation)
  • templates vs function pointers
  • macros vs inline (vs leaving it to the compiler?)
  • iteration vs recursion (eg, tail recursion)
  • #define vs static const?
  • pass by reference vs pass by value? (objects and/or primitives)
  • short primitives vs long primitives? (register use, memory use, cpu use)
  • initialisation vs assignment?

to be continued…

notes:should people writing libraries really put every function in its own file?
dynamic memory allocation during computation
data structures and system memory cache
difference between math on integers, fixed point, floating point, etc
multiplying by the reciprocal (single or multiple use, integer or floating point)
when testing integer multiplication, try powers of 2, 3, 5, 9, and some other number
should modulo be considered in bitshifting comparisons?
what about mixing single and double types? (with/without SSE2?)
*conversion between floating point and integer (extra copy, truncation vs rounding) -optimizing_cpp
integer ops for floating point manipulation -optimizing_cpp
hardware vs software for mathematical functions? -optimizing_cpp