This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 246829 - Do not create unneeded object in disabled loggers
Summary: Do not create unneeded object in disabled loggers
Status: RESOLVED FIXED
Alias: None
Product: ide
Classification: Unclassified
Component: Logger (show other bugs)
Version: 8.1
Hardware: PC Solaris
: P3 normal (vote)
Assignee: Alexander Simon
URL:
Keywords: PERFORMANCE
Depends on:
Blocks:
 
Reported: 2014-09-02 13:52 UTC by Alexander Simon
Modified: 2014-09-17 12:15 UTC (History)
2 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Alexander Simon 2014-09-02 13:52:28 UTC
IDE creates a lot of unneeded arrays in disabled loggers.
Typical developer mistake is:
LOG.log(Level.FINE, "some {0} {1}", new Object[] {o1, o2});
This code creates unneeded array.
Right pattern is:
if (LOG.isLoggable(Level.FINE)) {
  LOG.log(Level.FINE, "some {0} {1}", new Object[] {o1, o2});
}

It has influence on performance especially if code is called thousand times in second.
Comment 1 Alexander Simon 2014-09-02 14:04:21 UTC
fixed the most critical classes in change set:
http://hg.netbeans.org/cnd-main/rev/cffe46c08475
Comment 2 Quality Engineering 2014-09-03 02:27:50 UTC
Integrated into 'main-silver', will be available in build *201409030001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)

Changeset: http://hg.netbeans.org/main-silver/rev/cffe46c08475
User: Alexander Simon <alexvsimon@netbeans.org>
Log: fixed Bug #246829 Do not create unneeded object in disabled loggers
- fixed most critical classes.
Comment 3 Antonin Nebuzelsky 2014-09-15 10:14:20 UTC
Has this been reviewed by owners of the respective modules?

Definitely not a candidate for a patch. Adding 18 additional modules to the set of updates just for this change is not in the scope of the patch.

Removing "801patch-candidate" from the whiteboard.
Comment 4 Quality Engineering 2014-09-17 12:15:24 UTC
Integrated into 'releases/release801', will be available in build *201409171118* or newer. Wait for official and publicly available build.

Changeset: http://hg.netbeans.org/releases/rev/f6722e7a085e
User: Alexander Simon <alexvsimon@netbeans.org>
Log: fixed Bug #246829 Do not create unneeded object in disabled loggers
- fixed most critical classes.
(transplanted from cffe46c08475d7436c3ee0cd5c43f53222b27670)