You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jackrabbit.apache.org by "Julian Reschke (JIRA)" <ji...@apache.org> on 2007/09/28 14:16:50 UTC

[jira] Created: (JCR-1150) JCR2SPI: several performance improvements pointed out by Findbugs

JCR2SPI: several performance improvements pointed out by Findbugs
-----------------------------------------------------------------

                 Key: JCR-1150
                 URL: https://issues.apache.org/jira/browse/JCR-1150
             Project: Jackrabbit
          Issue Type: Improvement
          Components: SPI
            Reporter: Julian Reschke
            Priority: Minor


FindBug report:

M P Bx: Method org.apache.jackrabbit.jcr2spi.nodetype.BitsetENTCacheImpl.getBitNumber(QName) invokes inefficient Integer(int) constructor; use Integer.valueOf(int) instead	src/main/java/org/apache/jackrabbit/jcr2spi/nodetype	BitsetENTCacheImpl.java	line 177	1190981544656	1666284
M P Bx: Method org.apache.jackrabbit.jcr2spi.query.RowIteratorImpl$RowImpl.getValue(String) invokes inefficient Integer(int) constructor; use Integer.valueOf(int) instead	src/main/java/org/apache/jackrabbit/jcr2spi/query	RowIteratorImpl.java	line 247	1190981544671	1666292
M P Bx: Method org.apache.jackrabbit.jcr2spi.WorkspaceManager.onEventReceived(EventBundle[], InternalEventListener[]) invokes inefficient Integer(int) constructor; use Integer.valueOf(int) instead	src/main/java/org/apache/jackrabbit/jcr2spi	WorkspaceManager.java	line 616	1190981544640	1666279
M P WMI: Method org.apache.jackrabbit.jcr2spi.name.NamespaceCache.syncNamespaces(Map) makes inefficient use of keySet iterator instead of entrySet iterator	src/main/java/org/apache/jackrabbit/jcr2spi/name	NamespaceCache.java	line 193	1190981544656	1666283
M P WMI: Method org.apache.jackrabbit.jcr2spi.nodetype.NodeTypeRegistryImpl.internalRegister(Map) makes inefficient use of keySet iterator instead of entrySet iterator	src/main/java/org/apache/jackrabbit/jcr2spi/nodetype	NodeTypeRegistryImpl.java	line 524	1190981544656	1666285
M P WMI: Method org.apache.jackrabbit.jcr2spi.observation.ObservationManagerImpl.onEvent(EventBundle) makes inefficient use of keySet iterator instead of entrySet iterator	src/main/java/org/apache/jackrabbit/jcr2spi/observation	ObservationManagerImpl.java	line 189	1190981544656	1666286
M P WMI: Method org.apache.jackrabbit.jcr2spi.state.NodeState.persisted(ChangeLog) makes inefficient use of keySet iterator instead of entrySet iterator	src/main/java/org/apache/jackrabbit/jcr2spi/state	NodeState.java	line 275	1190981544671	1666297


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Re: [jira] Created: (JCR-1150) JCR2SPI: several performance improvements pointed out by Findbugs

Posted by Julian Reschke <ju...@gmx.de>.
Thomas Mueller wrote:
> Hi,
> 
> I like FindBugs, and it would be great to have a good configuration in
> subversion.
> The same for PMD and Checkstyle. People can then use it or not, but
> don't have to duplicate the setup.
> 
>> Integer(int) constructor; use Integer.valueOf(int) instead
> 
> This is Java 1.5. But what you could do is:

Oops. Thanks for pointing this out. Will fix.

> public class ObjectUtils {
>     public static Integer getInteger(int x) {
>         return new Integer(x); // NOPMD
>     }
> }
> 
> Then change the code so this method is called instead of creating
> Integer objects directly. Then if we switch to JDK 1.5, of if we want
> to build our own cache, we have to change it only there.
> 
>> makes inefficient use of keySet iterator instead of entrySet iterator
> 
> This should be changed if possible.

Best regards, Julian

Re: [jira] Created: (JCR-1150) JCR2SPI: several performance improvements pointed out by Findbugs

Posted by Thomas Mueller <th...@gmail.com>.
Hi,

I like FindBugs, and it would be great to have a good configuration in
subversion.
The same for PMD and Checkstyle. People can then use it or not, but
don't have to duplicate the setup.

> Integer(int) constructor; use Integer.valueOf(int) instead

This is Java 1.5. But what you could do is:

public class ObjectUtils {
    public static Integer getInteger(int x) {
        return new Integer(x); // NOPMD
    }
}

Then change the code so this method is called instead of creating
Integer objects directly. Then if we switch to JDK 1.5, of if we want
to build our own cache, we have to change it only there.

> makes inefficient use of keySet iterator instead of entrySet iterator

This should be changed if possible.

Thomas

[jira] Resolved: (JCR-1150) JCR2SPI: several performance improvements pointed out by Findbugs

Posted by "Julian Reschke (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/JCR-1150?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Julian Reschke resolved JCR-1150.
---------------------------------

    Resolution: Fixed

Fixed with revision 580332.


> JCR2SPI: several performance improvements pointed out by Findbugs
> -----------------------------------------------------------------
>
>                 Key: JCR-1150
>                 URL: https://issues.apache.org/jira/browse/JCR-1150
>             Project: Jackrabbit
>          Issue Type: Improvement
>          Components: SPI
>            Reporter: Julian Reschke
>            Priority: Minor
>
> FindBug report:
> M P Bx: Method org.apache.jackrabbit.jcr2spi.nodetype.BitsetENTCacheImpl.getBitNumber(QName) invokes inefficient Integer(int) constructor; use Integer.valueOf(int) instead	src/main/java/org/apache/jackrabbit/jcr2spi/nodetype	BitsetENTCacheImpl.java	line 177	1190981544656	1666284
> M P Bx: Method org.apache.jackrabbit.jcr2spi.query.RowIteratorImpl$RowImpl.getValue(String) invokes inefficient Integer(int) constructor; use Integer.valueOf(int) instead	src/main/java/org/apache/jackrabbit/jcr2spi/query	RowIteratorImpl.java	line 247	1190981544671	1666292
> M P Bx: Method org.apache.jackrabbit.jcr2spi.WorkspaceManager.onEventReceived(EventBundle[], InternalEventListener[]) invokes inefficient Integer(int) constructor; use Integer.valueOf(int) instead	src/main/java/org/apache/jackrabbit/jcr2spi	WorkspaceManager.java	line 616	1190981544640	1666279
> M P WMI: Method org.apache.jackrabbit.jcr2spi.name.NamespaceCache.syncNamespaces(Map) makes inefficient use of keySet iterator instead of entrySet iterator	src/main/java/org/apache/jackrabbit/jcr2spi/name	NamespaceCache.java	line 193	1190981544656	1666283
> M P WMI: Method org.apache.jackrabbit.jcr2spi.nodetype.NodeTypeRegistryImpl.internalRegister(Map) makes inefficient use of keySet iterator instead of entrySet iterator	src/main/java/org/apache/jackrabbit/jcr2spi/nodetype	NodeTypeRegistryImpl.java	line 524	1190981544656	1666285
> M P WMI: Method org.apache.jackrabbit.jcr2spi.observation.ObservationManagerImpl.onEvent(EventBundle) makes inefficient use of keySet iterator instead of entrySet iterator	src/main/java/org/apache/jackrabbit/jcr2spi/observation	ObservationManagerImpl.java	line 189	1190981544656	1666286
> M P WMI: Method org.apache.jackrabbit.jcr2spi.state.NodeState.persisted(ChangeLog) makes inefficient use of keySet iterator instead of entrySet iterator	src/main/java/org/apache/jackrabbit/jcr2spi/state	NodeState.java	line 275	1190981544671	1666297

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (JCR-1150) JCR2SPI: several performance improvements pointed out by Findbugs

Posted by "Julian Reschke (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/JCR-1150?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12531013 ] 

Julian Reschke commented on JCR-1150:
-------------------------------------

Backed out use of Integer.valueOf (not available in jdk 1.4) with revision 580347.

> JCR2SPI: several performance improvements pointed out by Findbugs
> -----------------------------------------------------------------
>
>                 Key: JCR-1150
>                 URL: https://issues.apache.org/jira/browse/JCR-1150
>             Project: Jackrabbit
>          Issue Type: Improvement
>          Components: SPI
>            Reporter: Julian Reschke
>            Priority: Minor
>
> FindBug report:
> M P Bx: Method org.apache.jackrabbit.jcr2spi.nodetype.BitsetENTCacheImpl.getBitNumber(QName) invokes inefficient Integer(int) constructor; use Integer.valueOf(int) instead	src/main/java/org/apache/jackrabbit/jcr2spi/nodetype	BitsetENTCacheImpl.java	line 177	1190981544656	1666284
> M P Bx: Method org.apache.jackrabbit.jcr2spi.query.RowIteratorImpl$RowImpl.getValue(String) invokes inefficient Integer(int) constructor; use Integer.valueOf(int) instead	src/main/java/org/apache/jackrabbit/jcr2spi/query	RowIteratorImpl.java	line 247	1190981544671	1666292
> M P Bx: Method org.apache.jackrabbit.jcr2spi.WorkspaceManager.onEventReceived(EventBundle[], InternalEventListener[]) invokes inefficient Integer(int) constructor; use Integer.valueOf(int) instead	src/main/java/org/apache/jackrabbit/jcr2spi	WorkspaceManager.java	line 616	1190981544640	1666279
> M P WMI: Method org.apache.jackrabbit.jcr2spi.name.NamespaceCache.syncNamespaces(Map) makes inefficient use of keySet iterator instead of entrySet iterator	src/main/java/org/apache/jackrabbit/jcr2spi/name	NamespaceCache.java	line 193	1190981544656	1666283
> M P WMI: Method org.apache.jackrabbit.jcr2spi.nodetype.NodeTypeRegistryImpl.internalRegister(Map) makes inefficient use of keySet iterator instead of entrySet iterator	src/main/java/org/apache/jackrabbit/jcr2spi/nodetype	NodeTypeRegistryImpl.java	line 524	1190981544656	1666285
> M P WMI: Method org.apache.jackrabbit.jcr2spi.observation.ObservationManagerImpl.onEvent(EventBundle) makes inefficient use of keySet iterator instead of entrySet iterator	src/main/java/org/apache/jackrabbit/jcr2spi/observation	ObservationManagerImpl.java	line 189	1190981544656	1666286
> M P WMI: Method org.apache.jackrabbit.jcr2spi.state.NodeState.persisted(ChangeLog) makes inefficient use of keySet iterator instead of entrySet iterator	src/main/java/org/apache/jackrabbit/jcr2spi/state	NodeState.java	line 275	1190981544671	1666297

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Resolved: (JCR-1150) JCR2SPI: several performance improvements pointed out by Findbugs

Posted by "Julian Reschke (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/JCR-1150?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Julian Reschke resolved JCR-1150.
---------------------------------

    Resolution: Fixed

Fixed newly broken code with revision 580427 (sorry!).


> JCR2SPI: several performance improvements pointed out by Findbugs
> -----------------------------------------------------------------
>
>                 Key: JCR-1150
>                 URL: https://issues.apache.org/jira/browse/JCR-1150
>             Project: Jackrabbit
>          Issue Type: Improvement
>          Components: SPI
>            Reporter: Julian Reschke
>            Assignee: Julian Reschke
>            Priority: Minor
>
> FindBug report:
> M P Bx: Method org.apache.jackrabbit.jcr2spi.nodetype.BitsetENTCacheImpl.getBitNumber(QName) invokes inefficient Integer(int) constructor; use Integer.valueOf(int) instead	src/main/java/org/apache/jackrabbit/jcr2spi/nodetype	BitsetENTCacheImpl.java	line 177	1190981544656	1666284
> M P Bx: Method org.apache.jackrabbit.jcr2spi.query.RowIteratorImpl$RowImpl.getValue(String) invokes inefficient Integer(int) constructor; use Integer.valueOf(int) instead	src/main/java/org/apache/jackrabbit/jcr2spi/query	RowIteratorImpl.java	line 247	1190981544671	1666292
> M P Bx: Method org.apache.jackrabbit.jcr2spi.WorkspaceManager.onEventReceived(EventBundle[], InternalEventListener[]) invokes inefficient Integer(int) constructor; use Integer.valueOf(int) instead	src/main/java/org/apache/jackrabbit/jcr2spi	WorkspaceManager.java	line 616	1190981544640	1666279
> M P WMI: Method org.apache.jackrabbit.jcr2spi.name.NamespaceCache.syncNamespaces(Map) makes inefficient use of keySet iterator instead of entrySet iterator	src/main/java/org/apache/jackrabbit/jcr2spi/name	NamespaceCache.java	line 193	1190981544656	1666283
> M P WMI: Method org.apache.jackrabbit.jcr2spi.nodetype.NodeTypeRegistryImpl.internalRegister(Map) makes inefficient use of keySet iterator instead of entrySet iterator	src/main/java/org/apache/jackrabbit/jcr2spi/nodetype	NodeTypeRegistryImpl.java	line 524	1190981544656	1666285
> M P WMI: Method org.apache.jackrabbit.jcr2spi.observation.ObservationManagerImpl.onEvent(EventBundle) makes inefficient use of keySet iterator instead of entrySet iterator	src/main/java/org/apache/jackrabbit/jcr2spi/observation	ObservationManagerImpl.java	line 189	1190981544656	1666286
> M P WMI: Method org.apache.jackrabbit.jcr2spi.state.NodeState.persisted(ChangeLog) makes inefficient use of keySet iterator instead of entrySet iterator	src/main/java/org/apache/jackrabbit/jcr2spi/state	NodeState.java	line 275	1190981544671	1666297

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Reopened: (JCR-1150) JCR2SPI: several performance improvements pointed out by Findbugs

Posted by "Julian Reschke (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/JCR-1150?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Julian Reschke reopened JCR-1150:
---------------------------------

      Assignee: Julian Reschke

> JCR2SPI: several performance improvements pointed out by Findbugs
> -----------------------------------------------------------------
>
>                 Key: JCR-1150
>                 URL: https://issues.apache.org/jira/browse/JCR-1150
>             Project: Jackrabbit
>          Issue Type: Improvement
>          Components: SPI
>            Reporter: Julian Reschke
>            Assignee: Julian Reschke
>            Priority: Minor
>
> FindBug report:
> M P Bx: Method org.apache.jackrabbit.jcr2spi.nodetype.BitsetENTCacheImpl.getBitNumber(QName) invokes inefficient Integer(int) constructor; use Integer.valueOf(int) instead	src/main/java/org/apache/jackrabbit/jcr2spi/nodetype	BitsetENTCacheImpl.java	line 177	1190981544656	1666284
> M P Bx: Method org.apache.jackrabbit.jcr2spi.query.RowIteratorImpl$RowImpl.getValue(String) invokes inefficient Integer(int) constructor; use Integer.valueOf(int) instead	src/main/java/org/apache/jackrabbit/jcr2spi/query	RowIteratorImpl.java	line 247	1190981544671	1666292
> M P Bx: Method org.apache.jackrabbit.jcr2spi.WorkspaceManager.onEventReceived(EventBundle[], InternalEventListener[]) invokes inefficient Integer(int) constructor; use Integer.valueOf(int) instead	src/main/java/org/apache/jackrabbit/jcr2spi	WorkspaceManager.java	line 616	1190981544640	1666279
> M P WMI: Method org.apache.jackrabbit.jcr2spi.name.NamespaceCache.syncNamespaces(Map) makes inefficient use of keySet iterator instead of entrySet iterator	src/main/java/org/apache/jackrabbit/jcr2spi/name	NamespaceCache.java	line 193	1190981544656	1666283
> M P WMI: Method org.apache.jackrabbit.jcr2spi.nodetype.NodeTypeRegistryImpl.internalRegister(Map) makes inefficient use of keySet iterator instead of entrySet iterator	src/main/java/org/apache/jackrabbit/jcr2spi/nodetype	NodeTypeRegistryImpl.java	line 524	1190981544656	1666285
> M P WMI: Method org.apache.jackrabbit.jcr2spi.observation.ObservationManagerImpl.onEvent(EventBundle) makes inefficient use of keySet iterator instead of entrySet iterator	src/main/java/org/apache/jackrabbit/jcr2spi/observation	ObservationManagerImpl.java	line 189	1190981544656	1666286
> M P WMI: Method org.apache.jackrabbit.jcr2spi.state.NodeState.persisted(ChangeLog) makes inefficient use of keySet iterator instead of entrySet iterator	src/main/java/org/apache/jackrabbit/jcr2spi/state	NodeState.java	line 275	1190981544671	1666297

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (JCR-1150) JCR2SPI: several performance improvements pointed out by Findbugs

Posted by "Jukka Zitting (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/JCR-1150?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jukka Zitting updated JCR-1150:
-------------------------------

    Fix Version/s: 1.4

> JCR2SPI: several performance improvements pointed out by Findbugs
> -----------------------------------------------------------------
>
>                 Key: JCR-1150
>                 URL: https://issues.apache.org/jira/browse/JCR-1150
>             Project: Jackrabbit
>          Issue Type: Improvement
>          Components: SPI
>            Reporter: Julian Reschke
>            Assignee: Julian Reschke
>            Priority: Minor
>             Fix For: 1.4
>
>
> FindBug report:
> M P Bx: Method org.apache.jackrabbit.jcr2spi.nodetype.BitsetENTCacheImpl.getBitNumber(QName) invokes inefficient Integer(int) constructor; use Integer.valueOf(int) instead	src/main/java/org/apache/jackrabbit/jcr2spi/nodetype	BitsetENTCacheImpl.java	line 177	1190981544656	1666284
> M P Bx: Method org.apache.jackrabbit.jcr2spi.query.RowIteratorImpl$RowImpl.getValue(String) invokes inefficient Integer(int) constructor; use Integer.valueOf(int) instead	src/main/java/org/apache/jackrabbit/jcr2spi/query	RowIteratorImpl.java	line 247	1190981544671	1666292
> M P Bx: Method org.apache.jackrabbit.jcr2spi.WorkspaceManager.onEventReceived(EventBundle[], InternalEventListener[]) invokes inefficient Integer(int) constructor; use Integer.valueOf(int) instead	src/main/java/org/apache/jackrabbit/jcr2spi	WorkspaceManager.java	line 616	1190981544640	1666279
> M P WMI: Method org.apache.jackrabbit.jcr2spi.name.NamespaceCache.syncNamespaces(Map) makes inefficient use of keySet iterator instead of entrySet iterator	src/main/java/org/apache/jackrabbit/jcr2spi/name	NamespaceCache.java	line 193	1190981544656	1666283
> M P WMI: Method org.apache.jackrabbit.jcr2spi.nodetype.NodeTypeRegistryImpl.internalRegister(Map) makes inefficient use of keySet iterator instead of entrySet iterator	src/main/java/org/apache/jackrabbit/jcr2spi/nodetype	NodeTypeRegistryImpl.java	line 524	1190981544656	1666285
> M P WMI: Method org.apache.jackrabbit.jcr2spi.observation.ObservationManagerImpl.onEvent(EventBundle) makes inefficient use of keySet iterator instead of entrySet iterator	src/main/java/org/apache/jackrabbit/jcr2spi/observation	ObservationManagerImpl.java	line 189	1190981544656	1666286
> M P WMI: Method org.apache.jackrabbit.jcr2spi.state.NodeState.persisted(ChangeLog) makes inefficient use of keySet iterator instead of entrySet iterator	src/main/java/org/apache/jackrabbit/jcr2spi/state	NodeState.java	line 275	1190981544671	1666297

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.