DEV Community

Hyporos
Hyporos

Posted on • Updated on

SPO600 - Week 7

Week 7 of my learnings for my SPO600 course included information about compiler optimizations. There was supposed to be a recording on the introduction of AArch64 and x86_64 but it was moved to week 8. So we only have one topic.

About compiler optimizations, let's start with a certain compiler first, namely GCC. The flags on this one are quite iconic, some of them being -O (adjusts level of optimization, O to O3), -pipe (avoids temporary files), and -g (logs debugging info).

Some popular optimization options for it are Loop Unswitching (swapping a condition inside a loop for loops inside a condition), Loop Switching (splitting a loop into two if both parts work differently) and Loop Unrolling (rendering the loop guaranteed to execute an even amount of times).

Using these, we can increase performance, readability, and more. It's an essential thing to know for any developer.

Top comments (0)