Menu

#2016 CIMObjectFactory uses # constructor instead of valueOf

Performance
closed-fixed
5
2010-09-15
2010-06-30
No

CIMObjectFactory's char16 ValueFactory method calls the Character constructor instead of using the better performing valueOf() method.

Bug: Method org.sblim.cimclient.internal.cimxml.sax.CIMObjectFactory$11.make(String) invokes inefficient new Character(char) constructor; use Character.valueOf(char) instead
Pattern id: DM_NUMBER_CTOR, type: Bx, category: PERFORMANCE

Using new Integer(int) is guaranteed to always result in a new object whereas Integer.valueOf(int) allows caching of values to be done by the compiler, class library, or JVM. Using of cached values avoids object allocation and the code will be faster.

Discussion

  • Dave Blaschke

    Dave Blaschke - 2010-06-30

    Fixing this eliminates 1 FindBugs issue

     
  • Dave Blaschke

    Dave Blaschke - 2010-06-30
    • status: open --> open-accepted
     
  • Dave Blaschke

    Dave Blaschke - 2010-07-02

    Patch sent for community review. During a 2 week period any
    exploiter may comment on the patch, request changes or turn it
    down completely (with good reason). For the time being the patch is part of the "Experimental" branch in CVS.

     
  • Dave Blaschke

    Dave Blaschke - 2010-07-02
    • status: open-accepted --> open-fixed
     
  • Dave Blaschke

    Dave Blaschke - 2010-07-28

    Patch against HEAD

     
  • Dave Blaschke

    Dave Blaschke - 2010-07-28

    The community review has completed and we received no substantial critisism. Therefore the patch has been approved and merged into the "HEAD" branch. The next release will pick it up.

     
  • Dave Blaschke

    Dave Blaschke - 2010-07-28
    • status: open-fixed --> pending-fixed
     
  • Dave Blaschke

    Dave Blaschke - 2010-09-15
    • status: pending-fixed --> closed-fixed
     
  • Dave Blaschke

    Dave Blaschke - 2010-09-15

    The patch was picked up by release 2.1.6 and will therefore be closed.

     

Log in to post a comment.