For some reason, I wound up reading about compilers’ use of vectorization in optimizing code yesterday, and I came across Felix von Leitner‘s pretty interesting presentation from 2009, “Source Code Optimization”.

While I knew that compilers are generally good at optimizing these days, I had no clue just how good they’ve become. This basically also means that a lot of the “general wisdom” I came up with when writing C and C++ no longer really applies, and even more so, that more readable code often seems to produce equally good or even more optimized code than most attempts at being clever. For C(++) code then, this means that we not only can but almost have to mentally shift from being “clever” to being concise when writing code – a development that’s been helped greatly by C11 and C++11.

If you write any C or C++ on a regular basis, I strongly suggest you add this presentation to your list of annual reminders.