doit
This commit is contained in:
37
performance-aware-programming/notes.org
Normal file
37
performance-aware-programming/notes.org
Normal file
@@ -0,0 +1,37 @@
|
||||
#+TITLE: Performance-Aware Programming
|
||||
#+AUTHOR: Casey Muratori
|
||||
|
||||
|
||||
* Definition
|
||||
Just knowing what you're doing can affect performance
|
||||
Not doing actual low level performance optimization for specific hardware
|
||||
|
||||
"If you understand CSS you should understand this"
|
||||
|
||||
* Thinking about the CPU
|
||||
|
||||
If you think of a processor as a box which takes instructions as inputs
|
||||
and then they do some work before producing the output, you have two
|
||||
levers to pull for performance.
|
||||
|
||||
1. Reduce the # of instructions
|
||||
Simplify the program or generally reduce the work that the CPU needs
|
||||
2. Speed of the Instruction
|
||||
Change the set of instructions you're passing through the CPU based
|
||||
on how much time it might take to process.
|
||||
|
||||
* Prologue
|
||||
|
||||
In a simple python program below: We achieve ~0.006 adds/cycle
|
||||
|
||||
#+begin_src python
|
||||
def add(a, b):
|
||||
a + b
|
||||
|
||||
c = 1234 + 5678
|
||||
#+end_src
|
||||
|
||||
|
||||
In the naive C version we're looking at ~0.8 adds/cycle
|
||||
|
||||
If we get smarter and do some optimization with SIMD we can achive up to 16 adds/cycle.
|
||||
Reference in New Issue
Block a user