[xquery-talk] performance gain due to using xquery

fatma helmy fatmahelmy2000 at yahoo.com
Wed May 24 11:21:04 PDT 2006

Dear all
thanks to comments of michael key, my xquery is
enhanced and i ran it on saxon , for a file of size 12
M, it took 14 minutes to finish
that is my optimized query

declare function local:pathOfNode($node) 
{if(empty($node/..)) then "" else
concat(local:pathOfNode($node/..), "/",
let $j:= doc("try.XML") 

let $paths := for $n in $j//* return

for $p in distinct-values($paths) 
let $papa:= replace($p,'/[^/]*$','') 
let $leafs :=$j//text()[normalize-space()]
eq substring-after(string($p),"/") ] 

where count
(tokenize(substring-after(string($p), "/"),"/")) >1
{string( round( count($paths[.=$p]) div
count($paths[.=$papa]) * 100 ) )} 
{for $val in  distinct-values( $leafs) 
let $kval := normalize-space($val) 
return <value-per-path value='{$kval}' 
count='{count($leafs[. eq  $kval ])}'/>} 

now i have the following questions:-
if i implemented the same function using xslt or by
using api from java or .net would i get performance
gain more than executing it on xquery engine?
if the xquery was the best, is that due to its
features as xquery in general or is it due to saxon.

Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 

More information about the talk mailing list