[
https://issues.apache.org/jira/browse/HADOOP-6884?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Tsz Wo (Nicholas), SZE updated HADOOP-6884:
-------------------------------------------
Attachment: FunAgain.java
FunAgain.java: Benchmarks comparing the following calls
- LOG.isDebugEnabled()
- static debug(..) as suggested by Doug
- LOG.debug(..), i.e. do nothing.
Result 1:
{noformat}
java.version = 1.6.0_10
java.runtime.name = Java(TM) SE Runtime Environment
java.runtime.version = 1.6.0_10-b33
java.vm.version = 11.0-b15
java.vm.vendor = Sun Microsystems Inc.
java.vm.name = Java HotSpot(TM) 64-Bit Server VM
java.vm.specification.version = 1.0
java.specification.version = 1.6
os.arch = amd64
os.name = Linux
os.version = 2.6.9-55.ELsmp
n=10000000
LOG.isDebugEnabled(): 82 ms
static debug(..) : 502 ms
LOG.debug(..) : 11644 ms
{noformat}
Result 2:
{noformat}
java.version = 1.6.0_16
java.runtime.name = Java(TM) SE Runtime Environment
java.runtime.version = 1.6.0_16-b01
java.vm.version = 14.2-b01
java.vm.vendor = Sun Microsystems Inc.
java.vm.name = Java HotSpot(TM) Client VM
java.vm.specification.version = 1.0
java.specification.version = 1.6
os.arch = x86
os.name = Windows XP
os.version = 5.1
n=10000000
LOG.isDebugEnabled(): 172 ms
static debug(..) : 547 ms
LOG.debug(..) : 40421 ms
{noformat}
+1 on committing the existing patch. We may work on the static debug(..) in a
separated JIRA.
> Add LOG.isDebugEnabled() guard for each LOG.debug("...")
> --------------------------------------------------------
>
> Key: HADOOP-6884
> URL: https://issues.apache.org/jira/browse/HADOOP-6884
> Project: Hadoop Common
> Issue Type: Improvement
> Affects Versions: 0.22.0
> Reporter: Erik Steffl
> Assignee: Erik Steffl
> Fix For: 0.22.0
>
> Attachments: FunAgain.java, HADOOP-6884-0.22-1.patch,
> HADOOP-6884-0.22.patch
>
>
> Each LOG.debug("...") should be executed only if LOG.isDebugEnabled() is
> true, in some cases it's expensive to construct the string that is being
> printed to log. It's much easier to always use LOG.isDebugEnabled() because
> it's easier to check (rather than in each case reason whether it's necessary
> or not).
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.