Ok, What a difference parenthesis or two can make :-).
Any guidance about what approaches are likely to give the best results with the current schema. Maybe breakout and assign sub expressions where possible?
/Andy


On Fri, Mar 9, 2012 at 12:12 PM, Christian Grün <christian.gruen@gmail.com> wrote:
Hi Andy,

it looks as if all expressions are optimized and evaluated in a little
bit different way. No doubt this will be handled sooner or later (but
it may take some time).

Thanks,
Christian
___________________________

On Tue, Mar 6, 2012 at 5:17 PM, Andy Bunce <bunce.andy@gmail.com> wrote:
> Using the factbook.xml database and a recent 7.1.2 beta, I am hitting some
> performance problems. To debug I have been trying some expressions in the
> GUI window. The goal is given a country id, get the capital. The examples
> use Albania ="f0_136"
>
> let $id:="f0_136"
> let $cap:=//country[@id=$id]/@capital
> return //city[@id=$cap]
> ------result------------
> <city id="f0_1461" country="f0_136" longitude="10.7" latitude="46.2">
>   <name>Tirane</name>
>   <population year="87">192000</population>
> </city>
> Time: 0.7ms
> Very nice. Sadly my code is not doing it like this! ( the xpath is being
> generated from some data description xml I have created)
>
> If I try in the GUI some Xpath variations they produce wildly different
> execution times
>
> let $id:="f0_136"
> return //city[@id=(//country[@id=$id]/@capital)]
> 26144ms
>
> let $id:="f0_136"
> return //city[@id=//country[@id=$id]/@capital]
> 25157ms
>
> let $id:="f0_136"
> return (//city)[@id=(//country[@id=$id]/@capital)]
> 550ms
>
> let $id:="f0_136"
> return (//city)[@id=((//country)[@id=$id]/@capital)]
> 6087ms
>
> I was expecting all these to perform about the same. They all produce the
> same result.
>
> /Andy
>
>
> _______________________________________________
> BaseX-Talk mailing list
> BaseX-Talk@mailman.uni-konstanz.de
> https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk
>