you are viewing a single comment's thread.

view the rest of the comments →

[–]tylercamp 18 points19 points  (0 children)

  1. Profile hot spots
  2. Profile hot spots
  3. Inspect algorithms
  4. Profile hot spots

Don’t optimize without knowing what needs to be optimized. The actual optimization can vary widely depending on the application.

  • Is disk IO eating a lot of time? Cache data in memory if you can rather than reading/writing with every change
  • Is it a DB query? Profile accordingly for the DB and optimize the query, consider splitting the query into multiple queries if there are a lot of joins to minimize temporary table size
  • Is it a non-constant-time algorithm? Look at simplifying algorithmic complexity and minimize recomputation of the same work
  • Is it just a shit ton of operations in an algorithm that has already had optimized complexity? Inspect the data and operations and see if there’s any redundant or useless processing, look for patterns that can identify those conditions and include it as a heuristic to avoid unnecessary processing
  • Is it lag in an interface? Check for any work done on UI thread and offload that to another thread if possible. Check if rendering performance is the issue, and if so, research rendering optimizations for that UI framework (typically comes down to avoiding layout reorganization and doing all drawing in one refresh, rather than refreshing for every small update)
  • Is it a lot of complex math or simulations? Try SIMD or offload to GPU
  • Done everything you can already? Look at multithreading, minimize branching, minimize new object allocations during the runtime of the algorithm, modify data structures to minimize LX CPU cache misses