On Fri, Jul 20, 2012 at 10:53 AM, Shezan Baig <[email protected]> wrote:
> On Fri, Jul 20, 2012 at 7:46 AM, Konstantin Tokarev <[email protected]> wrote:
>>
>> 19.07.2012, 22:20, "Filip Pizlo" <[email protected]>:
>>> Now consider the stream form:
>>> thingy << "foo " << a << " bar " << someWeirdNonsenseToEnableHex << b << " 
>>> baz " << c << endl;
>>> This is 8 procedure calls and three string constants. This code will be 
>>> somewhere around 8 times fatter. Hence, you will be less likely to want to 
>>> enable such debug statements in release builds both due to fears concerning 
>>> unnecessary increases in binary size, and unnecessary increases in compile 
>>> times.
>>
>> Well, if all << operators are inline, it will be optimized. You also don't 
>> have to add endl, because "thingy" can add '\n' and flush buffer at the end 
>> by default (like qDebug does)
>>
>
>
> Also, if "START_THINGY" and "END_THINGY" are defined as:
>
> #define START_THINGY  if (enableDebug) { thingy
> #define END_THINGY    << endl; }
>


And we could also wrap these macros with #ifdef ENABLE_THINGY, so even
the compile-time cost is eliminated if we don't want to include thingy
output in our build.
_______________________________________________
webkit-dev mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-dev

Reply via email to