fn:data() perfomance improvement!

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

fn:data() perfomance improvement!

Евгений-8
Hello All, one more! :)

In current eXist CVS functions "fn:max"  and "fn:min "not depend from
context and "/a/max(b)" or "/a/min(b)" take "infinity" ms :)
when "<a>" in some thousends docs


Patch for some perfomance increase see in attachment


Evgeny [hidden email]





Index: eXist-1.0/src/org/exist/xquery/functions/FunMin.java
===================================================================
RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/xquery/functions/FunMin.java,v
retrieving revision 1.7
diff -u -r1.7 FunMin.java
--- eXist-1.0/src/org/exist/xquery/functions/FunMin.java 15 Oct 2004 13:59:25 -0000 1.7
+++ eXist-1.0/src/org/exist/xquery/functions/FunMin.java 13 Oct 2005 13:33:08 -0000
@@ -78,6 +78,8 @@
  */
  public Sequence eval(Sequence contextSequence, Item contextItem)
  throws XPathException {
+ if(contextItem != null)
+ contextSequence = contextItem.toSequence();
  Sequence arg = getArgument(0).eval(contextSequence, contextItem);
  if (arg.getLength() == 0)
  return Sequence.EMPTY_SEQUENCE;

Index: eXist-1.0/src/org/exist/xquery/functions/FunMax.java
===================================================================
RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/xquery/functions/FunMax.java,v
retrieving revision 1.8
diff -u -r1.8 FunMax.java
--- eXist-1.0/src/org/exist/xquery/functions/FunMax.java 22 Mar 2005 19:25:45 -0000 1.8
+++ eXist-1.0/src/org/exist/xquery/functions/FunMax.java 13 Oct 2005 13:32:50 -0000
@@ -83,6 +83,8 @@
  */
  public Sequence eval(Sequence contextSequence, Item contextItem)
  throws XPathException {
+ if(contextItem != null)
+ contextSequence = contextItem.toSequence();
  Sequence arg = getArgument(0).eval(contextSequence, contextItem);
  if(arg.getLength() == 0)
  return Sequence.EMPTY_SEQUENCE;