This is a DRAFT of the second part of Chapter 4 - On CPU Physics and CPU Cycles, of the Vol.1 of an upcoming book "Efficient C++ Programming for Modern 64-bit CPUs" by Sherry Ignatchenko and Dmytro Ivanchykhin. Feel free to comment on it - especially if you see some factual inconsistencies, we'll be happy to fix them.
For the first part of Chapter 4, see https://6it.dev/blog/on-cpu-physics-and-cpu-cycles-80730 .
Cold Hard Numbers
Now, armed with all the information above (and adding bits from [Ignatchenko16a] , [Fog] , and other sources listed below), we can make an all-important diagram to replace micro-benchmarks for many practical purposes, and indicate costs of most popular operations in the dev’s vocabulary.
DISCLAIMER: all the numbers below are accurate only within an order of magnitude!
Note that some of the items here were not discussed above, and may need some additional explanation:
Multiplication / Division
Out of all the R-R operations out there, multiplication and especially division are…