From: Wolfgang M. M. <wol...@us...> - 2004-04-27 15:47:40
|
Update of /cvsroot/exist/eXist-1.0/src/org/exist/xquery In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28184/src/org/exist/xquery Modified Files: LocationStep.java ElementConstructor.java EnclosedExpr.java Log Message: * XQuery node construction consumed too much memory: instead of generating a SAX stream, nodes are now directly copied to the created output fragment. * QName objects are now created through the global name pool and thus shared between node objects. Index: LocationStep.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/xquery/LocationStep.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** LocationStep.java 25 Mar 2004 12:50:50 -0000 1.3 --- LocationStep.java 27 Apr 2004 15:46:58 -0000 1.4 *************** *** 196,208 **** ((VirtualNodeSet) result).setInPredicate(inPredicate); } else { ! DocumentSet docs = contextSet.getDocumentSet(); ! NodeSelector selector; ! if(axis == Constants.DESCENDANT_ATTRIBUTE_AXIS) ! selector = new DescendantSelector(contextSet, inPredicate); ! else ! selector = new ChildSelector(contextSet, inPredicate); ! result = context.getBroker().findElementsByTagName( ! ElementValue.ATTRIBUTE, docs, test.getName(), selector ! ); } return result; --- 196,220 ---- ((VirtualNodeSet) result).setInPredicate(inPredicate); } else { ! DocumentSet docs = contextSet.getDocumentSet(); ! if (currentSet == null || currentDocs == null || !(docs.equals(currentDocs))) { ! currentDocs = docs; ! currentSet = ! (NodeSet) context.getBroker().getAttributesByName( ! currentDocs, test.getName()); ! } ! if (axis == Constants.DESCENDANT_ATTRIBUTE_AXIS) { ! result = ! currentSet.selectAncestorDescendant( ! contextSet, ! NodeSet.DESCENDANT, ! inPredicate); ! ! } else { ! result = ! currentSet.selectParentChild( ! contextSet, ! NodeSet.DESCENDANT, ! inPredicate); ! } } return result; *************** *** 218,226 **** return vset; } else { ! DocumentSet docs = contextSet.getDocumentSet(); ! NodeSelector selector = new ChildSelector(contextSet, inPredicate); ! NodeSet result = context.getBroker().findElementsByTagName( ! ElementValue.ELEMENT, docs, test.getName(), selector ! ); return result; } --- 230,249 ---- return vset; } else { ! DocumentSet docs = contextSet.getDocumentSet(); ! if (currentSet == null || currentDocs == null || !(docs.equals(currentDocs))) { ! currentDocs = docs; ! currentSet = ! (NodeSet) context.getBroker().findElementsByTagName( ! ElementValue.ELEMENT, ! currentDocs, ! test.getName(), null); ! } ! NodeSet result = ! currentSet.selectParentChild(contextSet, NodeSet.DESCENDANT, inPredicate); ! // DocumentSet docs = contextSet.getDocumentSet(); ! // NodeSelector selector = new ChildSelector(contextSet, inPredicate); ! // NodeSet result = context.getBroker().findElementsByTagName( ! // ElementValue.ELEMENT, docs, test.getName(), selector ! // ); return result; } *************** *** 236,246 **** return vset; } else { ! DocumentSet docs = contextSet.getDocumentSet(); ! NodeSelector selector = axis == Constants.DESCENDANT_SELF_AXIS ? ! new DescendantOrSelfSelector(contextSet, inPredicate) : ! new DescendantSelector(contextSet, inPredicate); ! NodeSet result = context.getBroker().findElementsByTagName( ! ElementValue.ELEMENT, docs, test.getName(), selector ! ); return result; } --- 259,275 ---- return vset; } else { ! DocumentSet docs = contextSet.getDocumentSet(); ! if (currentSet == null || currentDocs == null || !(docs.equals(currentDocs))) { ! currentDocs = docs; ! currentSet = ! (NodeSet) context.getBroker().findElementsByTagName( ! ElementValue.ELEMENT, currentDocs, ! test.getName(), null); ! } ! NodeSet result = currentSet.selectAncestorDescendant( ! contextSet, ! NodeSet.DESCENDANT, ! axis == Constants.DESCENDANT_SELF_AXIS, ! inPredicate); return result; } Index: EnclosedExpr.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/xquery/EnclosedExpr.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** EnclosedExpr.java 23 Feb 2004 09:36:11 -0000 1.2 --- EnclosedExpr.java 27 Apr 2004 15:46:59 -0000 1.3 *************** *** 63,77 **** Item next = i.nextItem(); boolean readNext = true; ! StringBuffer buf = new StringBuffer(); while (next != null) { // if item is an atomic value, collect the string values of all // following atomic values and seperate them by a space. if (Type.subTypeOf(next.getType(), Type.ATOMIC)) { ! if (buf.length() > 0) buf.append(' '); buf.append(next.getStringValue()); next = i.nextItem(); } else if (Type.subTypeOf(next.getType(), Type.NODE)) { ! if (buf.length() > 0) { receiver.characters(buf); buf.setLength(0); --- 63,79 ---- Item next = i.nextItem(); boolean readNext = true; ! StringBuffer buf = null; while (next != null) { // if item is an atomic value, collect the string values of all // following atomic values and seperate them by a space. if (Type.subTypeOf(next.getType(), Type.ATOMIC)) { ! if(buf == null) ! buf = new StringBuffer(); ! else if (buf.length() > 0) buf.append(' '); buf.append(next.getStringValue()); next = i.nextItem(); } else if (Type.subTypeOf(next.getType(), Type.NODE)) { ! if (buf != null && buf.length() > 0) { receiver.characters(buf); buf.setLength(0); *************** *** 81,85 **** } } ! if (buf.length() > 0) receiver.characters(buf); } catch (SAXException e) { --- 83,87 ---- } } ! if (buf != null && buf.length() > 0) receiver.characters(buf); } catch (SAXException e) { Index: ElementConstructor.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/xquery/ElementConstructor.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** ElementConstructor.java 29 Jan 2004 15:06:42 -0000 1.1 --- ElementConstructor.java 27 Apr 2004 15:46:58 -0000 1.2 *************** *** 89,93 **** } } ! // process the remaining attributes for(Iterator i = attributes.iterator(); i.hasNext(); ) { constructor = (AttributeConstructor)i.next(); --- 89,93 ---- } } ! // process the remaining attributesCharArr for(Iterator i = attributes.iterator(); i.hasNext(); ) { constructor = (AttributeConstructor)i.next(); |