mkwan       2003/03/07 08:14:21

  Modified:    java/src/org/apache/xalan/xsltc/dom Tag: XSLTC_DTM
                        DOMWSFilter.java NodeSortRecord.java
               java/src/org/apache/xml/dtm/ref/sax2dtm Tag: XSLTC_DTM
                        SAX2DTM2.java
  Log:
  XSLTC_DTM performance work
  Improvement for xsl:strip-space by caching the DTM that is used last time.
  Better Collator handling in NodeSortRecord.
  
  Revision  Changes    Path
  No                   revision
  
  
  No                   revision
  
  
  1.1.2.6   +19 -6     
xml-xalan/java/src/org/apache/xalan/xsltc/dom/Attic/DOMWSFilter.java
  
  Index: DOMWSFilter.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/java/src/org/apache/xalan/xsltc/dom/Attic/DOMWSFilter.java,v
  retrieving revision 1.1.2.5
  retrieving revision 1.1.2.6
  diff -u -r1.1.2.5 -r1.1.2.6
  --- DOMWSFilter.java  17 Feb 2003 20:31:33 -0000      1.1.2.5
  +++ DOMWSFilter.java  7 Mar 2003 16:14:20 -0000       1.1.2.6
  @@ -78,6 +78,10 @@
       
       // The Hashtable for DTM to mapping array
       private Hashtable m_mappings;
  +    
  +    // Cache the DTM and mapping that are used last time
  +    private DTM m_currentDTM;
  +    private short[] m_currentMapping;
   
       /**
        * Construct an adapter connecting the <code>DTMWSFilter</code> interface
  @@ -118,13 +122,22 @@
               if (dtm instanceof SAXImpl) {
                   SAXImpl saxImpl = (SAXImpl)dtm;
                   
  -                short[] mapping = (short[])m_mappings.get(dtm);
  -                if (mapping == null) {
  -                    mapping = saxImpl.getMapping(m_translet.getNamesArray());
  -                    m_mappings.put(dtm, mapping);
  +                short[] mapping;
  +                if (dtm == m_currentDTM) {
  +                    mapping = m_currentMapping;
  +                }
  +                else {  
  +                    mapping = (short[])m_mappings.get(dtm);
  +                    if (mapping == null) {
  +                        mapping = saxImpl.getMapping(m_translet.getNamesArray());
  +                        m_mappings.put(dtm, mapping);
  +                        m_currentDTM = saxImpl;
  +                        m_currentMapping = mapping;
  +                    }
                   }
                   
  -                int expType = saxImpl.getExpandedTypeID(node);
  +                //int expType = saxImpl.getExpandedTypeID(node);
  +                int expType = saxImpl._exptype(saxImpl.makeNodeIdentity(node));
                   
                   // %OPT% The mapping array does not have information about all the
                   // exptypes. However it does contain enough information about all 
names
  
  
  
  1.8.10.6  +5 -1      
xml-xalan/java/src/org/apache/xalan/xsltc/dom/NodeSortRecord.java
  
  Index: NodeSortRecord.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/java/src/org/apache/xalan/xsltc/dom/NodeSortRecord.java,v
  retrieving revision 1.8.10.5
  retrieving revision 1.8.10.6
  diff -u -r1.8.10.5 -r1.8.10.6
  --- NodeSortRecord.java       6 Mar 2003 20:42:32 -0000       1.8.10.5
  +++ NodeSortRecord.java       7 Mar 2003 16:14:20 -0000       1.8.10.6
  @@ -88,6 +88,7 @@
        * A reference to a locale. May be updated by subclass if the stylesheet
        * specifies a different language.
        */
  +    protected static final Locale DEFAULT_LOCALE = Locale.getDefault();
       protected Locale _locale = Locale.getDefault();
   
       /**
  @@ -119,6 +120,9 @@
        */ 
       public NodeSortRecord(int node) {
        _node = node;
  +     if (_locale != DEFAULT_LOCALE) {
  +         _collator = Collator.getInstance(_locale);
  +     }
       }
   
       public NodeSortRecord() {
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.1.2.25  +17 -3     
xml-xalan/java/src/org/apache/xml/dtm/ref/sax2dtm/Attic/SAX2DTM2.java
  
  Index: SAX2DTM2.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/java/src/org/apache/xml/dtm/ref/sax2dtm/Attic/SAX2DTM2.java,v
  retrieving revision 1.1.2.24
  retrieving revision 1.1.2.25
  diff -u -r1.1.2.24 -r1.1.2.25
  --- SAX2DTM2.java     6 Mar 2003 21:22:00 -0000       1.1.2.24
  +++ SAX2DTM2.java     7 Mar 2003 16:14:20 -0000       1.1.2.25
  @@ -1847,7 +1847,12 @@
      */
     public final int _type2(int identity)
     {
  -    int eType = _exptype2(identity);
  +    //int eType = _exptype2(identity);
  +    int eType;
  +    if (identity < m_blocksize)
  +      eType = m_exptype_map0[identity];
  +    else
  +      eType = m_exptype_map[identity>>>m_SHIFT][identity&m_MASK];    
        
       if (NULL != eType)
         return m_extendedTypes[eType].getNodeType();
  @@ -1872,7 +1877,17 @@
     public final int getExpandedTypeID(int nodeHandle)
     {
       int nodeID = makeNodeIdentity(nodeHandle);
  -    return (nodeID != NULL) ? _exptype2(nodeID) : NULL;
  +    
  +    //return (nodeID != NULL) ? _exptype2(nodeID) : NULL;
  +    
  +    if (nodeID != NULL) {
  +      if (nodeID < m_blocksize)
  +        return m_exptype_map0[nodeID];
  +      else
  +        return m_exptype_map[nodeID>>>m_SHIFT][nodeID&m_MASK]; 
  +    }
  +    else
  +      return NULL;
     }
   
     /**
  @@ -1961,7 +1976,6 @@
       if(m_indexing)
         indexNode(exName, elemNode);
       
  -
       m_parents.push(elemNode);
   
       int startDecls = m_contextIndexes.peek();
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to