[Mesa-dev] [PATCH] Revert "configure.ac: Disable compiler optimizations when --enable-debug is set"

Marek Olšák maraeo at gmail.com
Tue Jan 8 10:25:50 PST 2013


I've had no problem with debugging even with -O2. Yeah, gdb cannot
show some variables sometimes, but I rarely had to force CFLAGS to -O0
to debug an issue. That said, I can continue overriding CFLAGS and
CXXFLAGS like I do now if the majority of people think that
--disable-optimizations would be useless.

Right now I use:

CFLAGS="-DDEBUG -O2 -g -fno-omit-frame-pointer"
CXXFLAGS="$CFLAGS"

Marek

On Tue, Jan 8, 2013 at 6:31 PM, Brian Paul <brianp at vmware.com> wrote:
> On 01/08/2013 08:38 AM, Marek Olšák wrote:
>>
>> This reverts commit 122345876479cf5cf553e38162ab105658614ab7.
>>
>> Some distributions use --enable-debug for testing packages and the commit
>> results in terrible CPU performance. It can be embarrassing for us.
>
>
> Surely people should understand that enabling debugging code/flags can
> adversely effect performance.
>
>
>
>> Those who do not want optimizations should set the CFLAGS and CXXFLAGS
>> environment variables. In my opinion, --enable-debug should only set
>> -DDEBUG.
>
>
> Previously, if we set --enable-debug we got -g -O2 which was pretty much
> useless if you planned to use gdb (and why else would you use
> --enable-debug?).  That's why I advocated -g -O0.
>
> Just setting -DDEBUG can lead to reduced performance too (in Mesa or in any
> other project).  For example in the past I've done stuff like:
>
> #ifdef DEBUG
>    do extra validation, error checking etc.
> #endif
>
> which could significantly impact performance, regardless of -g or -O.
>
> -Brian


More information about the mesa-dev mailing list