AsyncLogger: avoid useless concatenations if debug is disabled#52
AsyncLogger: avoid useless concatenations if debug is disabled#52jcodagnone wants to merge 1 commit intorapid7:masterfrom zauberlabs:avoid-cats-if-dbg-is-disabled
Conversation
| @@ -666,7 +674,9 @@ public void run() { | |||
| } catch (InterruptedException e) { | |||
| // We got interrupted, stop | |||
| dbg( "Asynchronous socket writer interrupted"); | |||
There was a problem hiding this comment.
You could add this call under the if as well... once debug is disabled there is no point in calling it. ;)
There was a problem hiding this comment.
dbg() will check if debug is enabled, so it wont be a gain (the gain is in avoiding the string concatenation).
There was a problem hiding this comment.
I knew it. But, even though you will reduce one if test. ;)
|
-1 Nope. Are the debug guards around accessors really a performance improvement? @jcodagnone Let's talk about setting up some JMH benchmarks for finding pain-points (and yes, you're probably correct in assuming there are some in |
Save same CPU cycles avoiding concatenating strings that wont be used when debug is disabled (also saves some GC cycles).