Rhyme your way to better programs: cache, hash, and thrash
There are myriad ways to optimize a program, but you can go a long way with three rhyming concepts:
cache - Perform operations once then store them; you trade memory for speed and reduced access to database (for example).
hash - Hash maps are fast and efficient for a lot of algorithms; for example, a trie (suffix tree) is faster when implemented as a hash map than as a tree (because insertions and lookup are constant time on average with a hash map but log(n) for trees).
thrash - Avoid competing for resources, as in database or hard drive lookups.
I thought cache, hash, and thrash was a neat mnemonic. Do you have another go-to for optimizations? Know any other neat mnemonics?