r/cpp • • Feb 04 '15

Compilers - What Every Programmer Should Know About Compiler Optimizations

https://msdn.microsoft.com/en-us/magazine/dn904673.aspx
2 Upvotes

4 comments sorted by

6

u/F-J-W Feb 04 '15

Could we please stop using those click-bait titles? The things that every programmer should know about compiler-optimizations can be written down in a few lines:

  • They exist and allow to write somewhat suboptimal code without performance-penalty if the better way is totally obvious.

  • They result in compiled code being often faster than handwritten assembly.

  • Under normal circumstances, they do not change the observable side-effects of a program.

Maybe there are one or two additional points, but really, I have no need at all, to know about VC-specific pragmas to control their optimization.

I admit, I didn't really read the article yet, but I scrolled over it enough to see that it is not what it claims (though it may very well be very interessting).

-6

u/nbajillionpoo Feb 04 '15

I feel dirty having visited msdn

2

u/SplinterOfChaos Feb 04 '15

I feel tricked into reading an article about how MSVC does optimization, even though I only have access to clang and gcc (linux user). I would really appreciate if someone did a comparative analysis of how well gcc, clang, and msvc performed specific optimizations.

8

u/[deleted] Feb 04 '15

Even though I mostly do my coding in Linux, I found the article to be well written and to contain useful information. All the concepts explained in the article exist in the other compilers as well, so you will not waste your time reading it.

At times after reading an article like this one I'll try to remind myself how somebody somewhere more knowledgeable on some issue than me took time to write an article about it for people like me to read, and all for free. I feel privileged.