Skip to content

Files

Latest commit

 

History

History
39 lines (27 loc) · 1.58 KB

lecture-24-critical-thinking.-code-optimizatino-aspects..md

File metadata and controls

39 lines (27 loc) · 1.58 KB

Lecture 24: Critical Thinking. Code Optimization Aspects.

Lecture Summary

  • Last time
    • Parallel computing, multi-core: how caches come into play
    • Critical thinking, and similar tricks for speeding up your code
  • Today
    • Critical thinking, and other similar tricks for speeding up your code

Know your hardware

Know your bandwidth/latency

Choose the right algorithm

  • When working on a problem, there's more to performance than asymptotic complexity
    • Because asymptotic complexity is most often defined by the number of operations
    • Memory transactions are rarely considered: they are specific to the hardware
  • Assess the arithmetic intensity associated with your problem

  • Simple optimization: Fusing transformations and do not bring data into the cache twice

Compiler

  • Aggressive optimizations done by the compiler might change the behavior of your code
  • To help the compiler:
    • Allow it to see as much code as possible
    • Provide flags to convey information (e.g., the target architecture)
  • There are a lot of amazing things covered in this lecture. The takeaways are:
    • Compilers are fantastic
    • Know them better to use them wisely
  • A quick example is down below. Refer to the slides for a lot more fun facts