c++ - Optimization and flags for making a static library with g++ -
I'm starting on Linux with the G + compiler and raises some questions on the compiler flag. Here they are
Optimization
, I have about optimization flag -O1 , -O2 I read in and in the G ++ manual page -O3 I did not understand when to use these flags, generally do you use the level of optimization? Call for G ++ manual below -O2 .
Make even more optimization. GCC performs almost all of the supported optimizations, which do not include the space-speed Todoof when you specify - Compiler loop does not inline or function inlining - compared to O, this option increases the performance of both compile time and generated code. is.
If this is not inlineing and loop unrolling, then how is it performed and is this option recommended?
Static Library
How do I create a static library using G ++? In Visual Studio, I can choose a class library project and it will be compiled into the "Lib" file. What is G ++ equivalent?
rule of thumb:
When you need to debug, -O Use -0 (and -g to prepare debugging symbols.)
When you are preparing to ship it, use O2.
When you use, O3 ...!
When you put it on an embedded system, use - (Optimize for size, not efficiency.)
Comments
Post a Comment