[XQuery Talk Mailing List Archive Home] [By Date] [By Thread] [By Subject] [By Author] [Recent Entries] [Reply To This Message]

[x-query-talk] trying to optimize xpath expression

Enric Jaen enric at nmg.upc.es
Fri Aug 25 23:34:17 PDT 2006


optimizing xpath expressions
(Sorry if you receive this mail duplicated)

Hi all,

I'd like to improve the performance of the following simple xpath expression, used inside this simple XQuery function:

declare function foo($input as node()) as item()+ {
 for $elem in $input//EEE/FFF
 return $elem
};


 I know that the input document has an structure like:

<AAA>
  <BBB>
    <CCC>
       <DDD>
          <EEE>
	     <FFF>
	  <EEE>
	     <FFF>
	  <EEE>
	     <FFF>
	  ...
      </DDD>
    </CCC>
  </BBB>
</AAA>

The names of  AAA, BBB, CCC, and DDD are unknown.


I have tried changing the expression $input//EEE/FFF to:

$input/*/*/*/*/EEE/FFF

which I think it should perform better because the lack of the '//' path  (please correct me if I am wrong), however the time consumed is very similar.

Similarly is happening with an XQuery function that performs:
$input//EEE[FFF=$FFF]/FFF

which I have changed it to:
$input/*/*/*/*/EEE/[FFF=$FFF]FFF

but the improvement is not that better.

I am using saxonB8.7.3, and I am calling the XQuery function from Java. I am trying with 1000 <EEE> elements. The function is compiled into an XQueryExpression before to invoke the UserFunction.call method. The input document is a DocumentWrapper object.

I wonder if there is something I can do to improve the performance of the Xpath expression?

Thanks in advance for any help.
-Enric




/**
 * Enric Jaen Villoldo
 * PhD student
 * http://nmg.upc.es/enric
 */





Purchase Stylus Studio Online Today!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2007 All Rights Reserved.