I'm doing some number crunching in C++, and I'm seeing a vast difference in CPU % usage when using -Os optimization in my Debug build. I would therefore like to profile my code with optimizations enabled, so that I don't waste time optimizing code that the compiler already optimizes well.
When I try to profile with -Os optimization, I can't get Instruments to symbolicate my code (even when I manually specify the location of my .dSYM file). It won't even show my top-level C++ member functions that are not templated or inlined.
I can get it to symbolicate fine when I specify the default -O0 optimization level.
So, is it even possible to profile with optimizations enabled? If so, then what's the trick to make it work?
I'm using XCode 4.3.3.
StepA()takes 100ms andStepB()takes 100ms. After optimization,StepA()takes 10ms andStepB()takes 50ms. Without profiling information with optimizations enabled, how am I supposed to know that I should focus my efforts onStepB(). - Emile Cormier