Author: doogie
Date: Wed Jan 27 19:52:27 2010
New Revision: 903802
URL:
http://svn.apache.org/viewvc?rev=903802&view=revLog:
Bother; these uses of FastMap are actually rather stupid. The map is
only populated once at startup, then never modified again. What I have
discovered is that, while FastMap is supposed to be more stable in
memory allocation and cpu utilization, there was one leg of it's
internal structure that was *extremely* unbalanced. Ie, consider a
binary tree with 128 nodes, with 7 top level nodes, and then all the
rest of the nodes are on one side of the tree. Since these maps are
never modified after startup, we might as well just use a HashMap here.
Modified:
ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelReader.java
ofbiz/trunk/framework/service/src/org/ofbiz/service/DispatchContext.java
Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelReader.java
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelReader.java?rev=903802&r1=903801&r2=903802&view=diff==============================================================================
--- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelReader.java (original)
+++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelReader.java Wed Jan 27 19:52:27 2010
@@ -20,6 +20,7 @@
import java.io.Serializable;
import java.util.Collection;
+import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
@@ -200,7 +201,7 @@
numRelations = 0;
numAutoRelations = 0;
- entityCache = FastMap.newInstance();
+ entityCache = new HashMap<String, ModelEntity>();
List<ModelViewEntity> tempViewEntityList = FastList.newInstance();
List<Element> tempExtendEntityElementList = FastList.newInstance();
@@ -224,7 +225,6 @@
Element docElement = document.getDocumentElement();
if (docElement == null) {
- entityCache = null;
return null;
}
docElement.normalize();
Modified: ofbiz/trunk/framework/service/src/org/ofbiz/service/DispatchContext.java
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/framework/service/src/org/ofbiz/service/DispatchContext.java?rev=903802&r1=903801&r2=903802&view=diff==============================================================================
--- ofbiz/trunk/framework/service/src/org/ofbiz/service/DispatchContext.java (original)
+++ ofbiz/trunk/framework/service/src/org/ofbiz/service/DispatchContext.java Wed Jan 27 19:52:27 2010
@@ -21,6 +21,7 @@
import java.io.Serializable;
import java.net.URL;
import java.util.Collection;
+import java.util.HashMap;
import java.util.Map;
import java.util.Set;
import java.util.TreeSet;
@@ -275,6 +276,7 @@
serviceMap.putAll(readerServiceMap);
}
}
+ serviceMap = new HashMap<String, ModelService>(serviceMap);
}
if (serviceMap != null) {
modelServiceMapByDispatcher.put(name, serviceMap);