3 ms·
The compiler cannot compete with the CPU because the CPU has strictly more information. Any memory access can take between 4 and thousands of cycles of time to
by Tuna-Fish 8y ago
The compiler cannot compete with the CPU because the CPU has strictly more information. Any memory access can take between 4 and thousands of cycles of time to execute, and the compiler won't know how long any of them take. The CPU can reorder based on exact knowledge.
- Symmetry 8y agoUsing profile guided optimization can help a lot with this in practice, though it isn't perfect.