Revision: 5695
          http://jnode.svn.sourceforge.net/jnode/?rev=5695&view=rev
Author:   fduminy
Date:     2009-12-11 00:14:12 +0000 (Fri, 11 Dec 2009)

Log Message:
-----------
optimization : specify initial capacity of the underlying map (mapCache) when 
entryArray != null

Modified Paths:
--------------
    trunk/core/src/core/org/jnode/util/BootableHashMap.java

Modified: trunk/core/src/core/org/jnode/util/BootableHashMap.java
===================================================================
--- trunk/core/src/core/org/jnode/util/BootableHashMap.java     2009-12-10 
23:42:46 UTC (rev 5694)
+++ trunk/core/src/core/org/jnode/util/BootableHashMap.java     2009-12-11 
00:14:12 UTC (rev 5695)
@@ -218,14 +218,18 @@
             throw new RuntimeException("Cannot change a locked 
BootableHashMap");
         }
         if (mapCache == null) {
-            mapCache = new HashMap<K, V>();
             if (entryArray != null) {
                 final int max = entryArray.length;
+                
+                mapCache = new HashMap<K, V>(max);                
                 for (int i = 0; i < max; i++) {
                     final Entry<K, V> e = entryArray[i];
                     mapCache.put(e.getKey(), e.getValue());
                 }
+                
                 entryArray = null;
+            } else {
+                mapCache = new HashMap<K, V>();                
             }
         }
         return mapCache;


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

------------------------------------------------------------------------------
Return on Information:
Google Enterprise Search pays you back
Get the facts.
http://p.sf.net/sfu/google-dev2dev
_______________________________________________
Jnode-svn-commits mailing list
Jnode-svn-commits@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jnode-svn-commits

Reply via email to