[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/..), "/",
local-name($node))}; 
let $j:= doc("try.XML") 

let $paths := for $n in $j//* return
local:pathOfNode($n) 

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

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

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 
http://mail.yahoo.com 


More information about the talk mailing list