The Art of Benchmarking
Have a good baseline! - code::dive / Fastware 2015 - Andrei
- Amdahl’s law
- optimize outside / profile again within the application
-
doNotOptimizeAway()
- Baselines - have a good baseline
- beware of baseline x2 (cache/alloc memory)
- don’t do sequencing comparison
- beware of data pattern
-
facebook/folly benchmark framework
- Prefer to use:
- Prefer
a[i++]
toa[++i]
- less data dependency / better hardware usage / better parrallelisation. - minimize jump (keep flow)
- keep pattern access (prefetching)
- The hotest place on earth is the stack.
- Globals are bad, because they pessimize everything for the compiler.
- Prefer
followup
- many ALU permit instruction level parallelism
- to use them have fewer data dependencies
- eg String to int
- to use them have fewer data dependencies
Written on September 21, 2019, Last update on July 6, 2021
c++
fastware