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

Brian Paul brianp at vmware.com
Tue Jan 8 09:31:33 PST 2013


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