Any noticable impact on the binary code size?
--
- Milan

On Oct 3, 2014, at 16:12 , Eric Rahm <er...@mozilla.com> wrote:

> Hi all-
> 
> In bug 806819 we're planning on landing a change that allows us to turn on 
> NSPR logging in release builds [1]. To be clear, by default all logging 
> output is disabled, this will just allow you to turn on logging via the same 
> mechanisms [2] that have been available to debug builds and modules that 
> already force logging to be enabled.
> 
> Initial tests show no impact to performance, but of course it's possible 
> there will be unforeseen regressions. Testing included all Talos tests, 
> averaging of mochitest runtimes, and local ad-hoc performance measurements.
> 
> Areas to look out for:
>  * Logging being done in "hot" areas. PR_LOG is no longer a no-op so
>    there is a slight amount of overhead with each logging call. If
>    your output is truly debug only consider wrapping in a #ifdef DEBUG
>    block.
>  * Creating a log message and then logging it. PR_LOG supports printf
>    style formatting, so you can save some overhead by using that
>    rather than writing to your own buffer.
> 
>    For example, if you once had:
> 
>      #ifdef PR_LOGGING
>        char* msg = expensiveFunction();
>        PR_LOG(module, PR_LOG_DEBUG, (msg));
>      #endif
> 
>    You'll want to move to:
> 
>      PR_LOG(module, PR_LOG_DEBUG, ("%s", expensiveFunction()));
> 
> If you're interested in making logging better, please take a look at our meta 
> bug [3] tracking various improvements. There's talk of making improvements to 
> NSPR logging, ditching NSPR logging all together, adding streaming 
> interfaces, switching log levels at runtime, and more. Feel free to join in 
> the conversation.
> 
> Please note: after this change you should never need to use FORCE_PR_LOG (and 
> you'll probably get build errors if you do).
> 
> A few side benefits:
>  * All usage of FORCE_PR_LOG has been removed
>  * Many more files are now eligible for unified building
> 
> -e
> 
> [1] https://bugzilla.mozilla.org/show_bug.cgi?id=806819
> [2] 
> https://developer.mozilla.org/en-US/docs/Mozilla/Projects/NSPR/Reference/Logging
> [3] https://bugzilla.mozilla.org/show_bug.cgi?id=881389
> _______________________________________________
> dev-platform mailing list
> dev-platform@lists.mozilla.org
> https://lists.mozilla.org/listinfo/dev-platform

_______________________________________________
dev-platform mailing list
dev-platform@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-platform

Reply via email to