I first noticed in 2009 that gcc (at least on my projects and on my machines) have the tendency to generate noticeably faster code if I optimize for size (
-Os) instead of speed (
-O3) and I have been wondering ever since why.
I have managed to create a (rather silly) code that shows this surprising behavior and is sufficiently small to be posted here.
There’s so much going on in modern processors that it can be tough to predict how code will behave.
Stay up-to-date by subscribing to the Comments RSS Feed for this post.