4 ms·
I'm not sure measuring the number of CPU instructions makes much sense anymore. In my experience micro-optimizing code, the majority of time is spent waiting f
by Peaker 14y ago
I'm not sure measuring the number of CPU instructions makes much sense anymore.
In my experience micro-optimizing code, the majority of time is spent waiting for memory (bandwidth waits or even worse: latency costs).
- jlouis 14y agoPrecisely. This is why I mentioned the 30-50 mems. A typical main memory fetch is somewhere in the 100-200ns range on modern hardware. I tend to measure the effectiveness of an algorithm based on, roughly, how it accesses memory. Caches play a role as well, of course. L1 is around 1ns sometimes even less. if you hit L2 it is in the vicinity of 5-10ns. It easily translates to some 30-40 insns on modern hardware. It also tells you that hunting for faster execution by compressing instructions down is not going to cut you that much extra speed nowadays. The key to fast programs is data representation. Good data representation.