Comment by smallstepforman
3 days ago
C allowed pointer aliasing, so you always have to refresh reads incase a pojnter modified the value. With any loop, that is just more reads to update dependancies every cycle. When not aliased, you cache value in register. Much later C introduced “restrict” keyword to match fortran performance code. c++ is still fighting this by insisting you work with different types, hence by default you dont get aliasing but that doesnt cover 100% of scenarios.
Maybe we get restrict in C++35
No comments yet
Contribute on Hacker News ↗