On Thu, Apr 21, 2011 at 1:50 PM, Daniel Rice (דניאל רייס)
<[email protected]> wrote:
>  I ran a Showcase compile with log level 'info' 4 times each way, and
> took the average of the 3 best times for each way:
>
> Without 'if' tests: 396 seconds
> With 'if' tests: 350 seconds


wow, this is fantastic.

>
> So this feels like a small but significant savings.
>
> My thinking about where to put guards is as follows (for comparison,
> in Android it was policy to always put guards):
>
> 1) For WARNING or ERROR messages, don't put a guard since these will
> usually be emitted anyway
> 2) For lower priorities, put a guard if there is any code more complex
> than simply passing a constant or pre-existing string
>  2a) If the message is not emitted, we perform one comparison against
> an object instance field, which
>         we would have done anyway inside of logger.log
>  2b) If the message is emitted, we have done one extra comparison,
> but the cost will be swamped by the cost
>         of actually emitting the message
>
> So, I don't think we can really make things slower in any realistic scenario.
>
> On Tue, Apr 19, 2011 at 3:08 PM,  <[email protected]> wrote:
>> The actual code changes LGTM, but I am skeptical about the performance
>> benefits of guarding all the ones that do nothing more than string
>> concats.  If that is really too expensive, then virtually no log call
>> should be unguarded, and we should just require callers to insert their
>> own guards and remove the check from log/branch.
>>
>> Before committing the guards around just string concats, I would like to
>> see some measurements that suggest it is worth the cost of cluttering up
>> the code.
>>
>> http://gwt-code-reviews.appspot.com/1426802/
>>
>
> --
> http://groups.google.com/group/Google-Web-Toolkit-Contributors
>



-- 
Eric Z. Ayers
Google Web Toolkit, Atlanta, GA USA

-- 
http://groups.google.com/group/Google-Web-Toolkit-Contributors

Reply via email to