I ran into a case where adding an extra line of code to a loop caused the performance to improve despite the fact that it was now having to do more work through each iteration than before. I just wrote a blog post about it.
Have you ever encountered counterintuitive behavior in your code?
@Geoff_Perlman - if you haven’t seen it, you might enjoy this short YouTube series:
It’s a really interesting and informative series, showing how different compilers (GCC and Clang) and different targets (x86, ARM) can end up creating significantly different sets of instructions based on:
Optimization level
Targeted CPU’s “generation”
How the actual code is structured
I really enjoyed the whole series. It’s fascinating to see how clever (and occasionally not so clever) compilers can be in trying to optimize code.
Your blog suggested that the ARM was involved but wondering if it’s a compiler artifact? Going to check some of my encryption methods and see if variations make a difference.