1 Reply Latest reply on Apr 9, 2008 8:59 AM by Thomas Heute

    PortalCMSCacheLoader.java optimization

    front line Newbie

      I noticed that the method lookupNodeId in this class got quite slow when I had many entries in the CMS.
      It seems to loop through the nodeNames hash values and search for a match and then returns the key.
      I made an additional hash "nodeIds" which is the reverse of the hash mentioned above so from here this method can lookup the value straight.
      I just added this to parseNodeName where the hash is used:

      PortalCMSCacheLoader.nodeNames.put(id, node);
      // added this line
      PortalCMSCacheLoader.nodeIds.put(node, id);

      And then the lookupNodeId method becomes just:
      return (String)nodeIds.get(nodeName);

      This improved performance noticeably.