From: <fd...@us...> - 2009-12-11 00:18:58
|
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. |