3 ms·
I know you know this but instructions are basically free in the face of memory access and random memory access is the worst. Linear scans over contiguous memory
by sitkack 4y ago
I know you know this but instructions are basically free in the face of memory access and random memory access is the worst. Linear scans over contiguous memory (per thread) generally optimizes performance.
Instruction counts are only useful if everything is guaranteed to be in registers.
- slavik81 4y agoIt can be tough even without the impact of the memory hierarchy. I've seen code where adding an extra instruction to the calculation made it faster. The extra instruction implicitly eliminated denormals, thus resulting in faster execution with some workloads on systems where operations on denormal values were slower than operations on other values. It was a completely unnecessary instruction from a correctness perspective, because it had no effect on the answer. However, it was important for performance; removing the instruction made the calculation slower.
- sitkack 4y agoDamn. It would be fun to non-destructively randomize the instruction stream and have an ML model learn how to remove hazards.