This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [RFC] Have assert macros


Nathan Sidwell wrote:

Hi,
I did some measurements to determine how much leaving in our self checking
mechanism of the form
if (expr)
abort()
was costing us in compilation speed. I built 4 --disable-checking
compilers, with the following tweaks
0) baseline
1) #define abort to no-op, thus allowing the optimizer can remove the
controlling expression
2) #define abort to no-op and g++'s my_friendly_assert to no-op
3) Leave abort alone, but #define my_friendly_assert to
__builtin_constant_p (expr) && !expr ? abort() : 0
thus removing the runtime-checked asserts but leaving in the compile
time checked asserts.


The results I got for cc1plus on an i686-pc-linux-gnu system were (for the
two sets of flags)
-g -O0 -g -O2 textsize
#0 2.75 2.81 4,582,627
#1 2.79(+1.5%) 2.77(-1.5%) 4,488,595(-2.0%)
#2 2.74(-0.5%) 2.79(-0.8%) 4,468,467(-2.5%)
#3 2.71(-1.5%) 2.74(-2.5%) 4,565,603(-0.5%)


As you can see, all but unoptimzed #1 is an improvement. Why is that one
worse? One thing noticable about #1 is that I had many 'foo might be used
uninitialized' warnings during bootstrap. These all come from code like


...

Opinions on this proposal?

I am in favor. I think that you should wait a few days, and then interpret silence as assent, if nobody else speaks up...


--
Mark Mitchell
CodeSourcery, LLC
(916) 791-8304
mark@codesourcery.com


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]