[MINOR] Clean up of isDebugEnabled() usages#2435
[MINOR] Clean up of isDebugEnabled() usages#2435e-strauss wants to merge 1 commit intoapache:mainfrom
Conversation
| if(LOG.isDebugEnabled()) | ||
| LOG.debug("Begin Function "+fkey); | ||
|
|
||
| LOG.debug("Begin Function " + fkey); |
There was a problem hiding this comment.
The main difference here, is that the LOG.isDebugEnabled() is very cheap, while the string concatenation can be very expensive. Unfortunately to call the LOG.debug java has to resolve the string variable input, and that is the main time used, especially if Logging is disabled.
I do not know if there is a way to avoid the string concatenation, or somehow getting it delayed to after the logging is analysed to be off.
There was a problem hiding this comment.
I see your point, but isnt it in practice in micro-level noise for these simple concats? i think we might over-engineer here
Why are we sticking to apache commons logging? with the newer SLF4J we would could do stuff like this:
LOG.debug("Begin Function {}", fkey);also SLF4J might already be used inside apachae commons logging, since it's already in the pom
This PR is a followup to #2432 .
We have 131 Usages of LOG.isDebugEnabled()
This minor change refactors 15 occurrences of the 131 isDebugEnabled() call to an unconditional log.debug(), which should not introduce real overhead from my perspective.
i am not sure about the change in
src/main/java/org/apache/sysds/hops/DataOp.javabecause i have no idea how common this op is.