Question

I've got a question in one of my tests that asked me to answer what switch statement produce the least efficient machine code. The possible answers were O4, O1, O2, or O3. I don't event know what those are supposed to mean.

Was it helpful?

Solution

GCC Options That Control Optimization

-O -O1 Optimize. Optimizing compilation takes somewhat more time, and a lot more memory for a large function.

-O2 Optimize even more. GCC performs nearly all supported optimizations that do not involve a space-speed tradeoff. As compared to -O, this option increases both compilation time and the performance of the generated code.

-O3 Optimize yet more

-Os Optimize for size.

-Ofast Disregard strict standards compliance. -Ofast enables all -O3 optimizations. It also enables optimizations that are not valid for all standard compliant programs

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top