You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xerces.apache.org by mr...@apache.org on 2007/12/12 04:49:33 UTC

svn commit: r603450 - /xerces/java/trunk/src/org/apache/xerces/dom/DeferredDocumentImpl.java

Author: mrglavas
Date: Tue Dec 11 19:49:33 2007
New Revision: 603450

URL: http://svn.apache.org/viewvc?rev=603450&view=rev
Log:
Minor performance improvement. Use an (unsynchronized) 
ArrayList instead of Vector for collecting String chunks.

Modified:
    xerces/java/trunk/src/org/apache/xerces/dom/DeferredDocumentImpl.java

Modified: xerces/java/trunk/src/org/apache/xerces/dom/DeferredDocumentImpl.java
URL: http://svn.apache.org/viewvc/xerces/java/trunk/src/org/apache/xerces/dom/DeferredDocumentImpl.java?rev=603450&r1=603449&r2=603450&view=diff
==============================================================================
--- xerces/java/trunk/src/org/apache/xerces/dom/DeferredDocumentImpl.java (original)
+++ xerces/java/trunk/src/org/apache/xerces/dom/DeferredDocumentImpl.java Tue Dec 11 19:49:33 2007
@@ -17,12 +17,12 @@
 
 package org.apache.xerces.dom;
 
+import java.util.ArrayList;
+
 import org.w3c.dom.DOMImplementation;
 import org.w3c.dom.Element;
 import org.w3c.dom.Node;
 
-import java.util.Vector;
-
 /**
  * The Document interface represents the entire HTML or XML document.
  * Conceptually, it is the root of the document tree, and provides the
@@ -130,7 +130,7 @@
     // private data
     //
     private transient final StringBuffer fBufferStr = new StringBuffer();
-    private transient final Vector fStrChunks = new Vector();
+    private transient final ArrayList fStrChunks = new ArrayList();
 
     //
     // Constructors
@@ -1157,14 +1157,14 @@
                 // append data that is stored in fNodeValue
                 // REVISIT: for text nodes it works differently than for CDATA
                 //          nodes.
-                fStrChunks.addElement(value);
+                fStrChunks.add(value);
                 do {
                     // go in reverse order: find last child, then
                     // its previous sibling, etc
                     chunk = prevSib >> CHUNK_SHIFT;
                     index = prevSib & CHUNK_MASK;
                     value = getChunkValue(fNodeValue, chunk, index);
-                    fStrChunks.addElement(value);
+                    fStrChunks.add(value);
                     prevSib = getChunkIndex(fNodePrevSib, chunk, index);
                     if (prevSib == -1) {
                         break;
@@ -1175,11 +1175,11 @@
 
                 // add to the buffer in the correct order.
                 for (int i = chunkCount - 1; i >= 0; i--) {                                                               
-                    fBufferStr.append((String)fStrChunks.elementAt(i));
+                    fBufferStr.append((String)fStrChunks.get(i));
                 }
                 
                 value = fBufferStr.toString();
-                fStrChunks.removeAllElements();
+                fStrChunks.clear();
                 fBufferStr.setLength(0);
                 return value;
             }
@@ -1196,16 +1196,16 @@
                    chunk = child >> CHUNK_SHIFT;
                     index = child & CHUNK_MASK;
                     value = getChunkValue(fNodeValue, chunk, index);
-                    fStrChunks.addElement(value);
+                    fStrChunks.add(value);
                     child = getChunkIndex(fNodePrevSib, chunk, index);
                 }
                 // add to the buffer in the correct order.
                 for (int i=fStrChunks.size()-1; i>=0; i--) {                                                               
-                     fBufferStr.append((String)fStrChunks.elementAt(i));
+                     fBufferStr.append((String)fStrChunks.get(i));
                 }
                                                          
                 value = fBufferStr.toString();
-                fStrChunks.setSize(0);
+                fStrChunks.clear();
                 fBufferStr.setLength(0);
                 return value;
             }



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@xerces.apache.org
For additional commands, e-mail: commits-help@xerces.apache.org