Recommended clang optimization level?
What's the "standard" op开发者_StackOverflow中文版timization level used for clang? I believe that "O2" is a good choice for gcc - does that hold for clang also, or is there a generally better alternative?
-O2
and -Os
are both good choices for general use with clang.
-O3
will usually give you both the smallest and fastest code, but does tend to expose non obvious bugs in your code.
In general, you should make sure your code runs fine with all possible optimizations.
精彩评论