Author: mrglavas
Date: Fri Feb 19 03:43:57 2010
New Revision: 911695
URL: http://svn.apache.org/viewvc?rev=911695&view=rev
Log:
Performance: Replacing Vectors with unsynchronized ArrayLists and HashTables
with unsynchronized HashMaps. Should give a small boost to IDC processing.
Modified:
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XMLSchemaValidator.java
Modified:
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XMLSchemaValidator.java
URL:
http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XMLSchemaValidator.java?rev=911695&r1=911694&r2=911695&view=diff
==============================================================================
---
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XMLSchemaValidator.java
(original)
+++
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XMLSchemaValidator.java
Fri Feb 19 03:43:57 2010
@@ -20,6 +20,7 @@
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
+import java.util.HashMap;
import java.util.Hashtable;
import java.util.Iterator;
import java.util.Map;
@@ -4645,7 +4646,7 @@
// values stores
/** stores all global Values stores. */
- protected final Vector fValueStores = new Vector();
+ protected final ArrayList fValueStores = new ArrayList();
/**
* Values stores associated to specific identity constraints.
@@ -4656,7 +4657,7 @@
* descendant-or-self axes occur on recursively-defined
* elements.
*/
- protected final Hashtable fIdentityConstraint2ValueStoreMap = new
Hashtable();
+ protected final HashMap fIdentityConstraint2ValueStoreMap = new
HashMap();
// sketch of algorithm:
// - when a constraint is first encountered, its
@@ -4678,7 +4679,7 @@
// the fGlobalIDConstraintMap contains descendants+self.
// keyrefs can only match descendants+self.
protected final Stack fGlobalMapStack = new Stack();
- protected final Hashtable fGlobalIDConstraintMap = new Hashtable();
+ protected final HashMap fGlobalIDConstraintMap = new HashMap();
//
// Constructors
@@ -4694,7 +4695,7 @@
/** Resets the identity constraint cache. */
public void startDocument() {
- fValueStores.removeAllElements();
+ fValueStores.clear();
fIdentityConstraint2ValueStoreMap.clear();
fGlobalIDConstraintMap.clear();
fGlobalMapStack.removeAllElements();
@@ -4703,7 +4704,7 @@
// startElement: pushes the current fGlobalIDConstraintMap
// onto fGlobalMapStack and clears fGlobalIDConstraint map.
public void startElement() {
- // only clone the hashtable when there are elements
+ // only clone the map when there are elements
if (fGlobalIDConstraintMap.size() > 0)
fGlobalMapStack.push(fGlobalIDConstraintMap.clone());
else
@@ -4764,7 +4765,7 @@
uniqueValueStore.clear();
uniqueValueStore.setElementName(eDecl.getName());
}
- fValueStores.addElement(uniqueValueStore);
+ fValueStores.add(uniqueValueStore);
activateSelectorFor(icArray[i]);
break;
case (IdentityConstraint.IC_KEY) :
@@ -4780,7 +4781,7 @@
keyValueStore.clear();
keyValueStore.setElementName(eDecl.getName());
}
- fValueStores.addElement(keyValueStore);
+ fValueStores.add(keyValueStore);
activateSelectorFor(icArray[i]);
break;
case (IdentityConstraint.IC_KEYREF) :
@@ -4796,7 +4797,7 @@
keyRefValueStore.clear();
keyRefValueStore.setElementName(eDecl.getName());
}
- fValueStores.addElement(keyRefValueStore);
+ fValueStores.add(keyRefValueStore);
activateSelectorFor(icArray[i]);
break;
}
@@ -4840,7 +4841,7 @@
int count = fValueStores.size();
for (int i = 0; i < count; i++) {
- ValueStoreBase valueStore = (ValueStoreBase)
fValueStores.elementAt(i);
+ ValueStoreBase valueStore = (ValueStoreBase)
fValueStores.get(i);
valueStore.endDocument();
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]