[xquery-talk] Re: Optimizations
Rémi Dewitte
remi at gide.net
Fri Oct 3 16:23:45 PDT 2008
Hi again,
In the same spirit, this is not at all optimized.
Maybe I need Saxon SA ?
declare variable $level as xs:integer := 3 ;
declare function local:debug($l as xs:integer,$what){
if($l >=4) then
<debug>{$what}</debug>
else ()
};
let $dosmthg := <oki>test trace</oki>
return
(local:debug($level,$dosmthg),$dosmthg)
Rémi
On Fri, Oct 3, 2008 at 3:17 PM, Rémi Dewitte <remi at gide.net> wrote:
> Hi,
>
> I have made a little experiment after reading Michael (Kay) blog posts
> about optimizations and recent James Fuller article.
>
> I have a question quite specific to saxon still interesting in general.
>
> Why in the following example even the function call is not skipped ?
>
>
> XQuery is ::
>
> declare variable $level := 3;
>
> declare function local:debug($what){
> if($level >=4) then
> <debug>{$what}</debug>
> else ()
> };
>
> let $dosmthg := <oki>test trace</oki>
>
> return
> (local:debug($dosmthg),$dosmthg)
>
> When I run saxon with -explain we get
>
> <query>
> <globalVariables>
> <declareVariable name="level">
> <literal value="3" type="xs:integer"/>
> </declareVariable>
> </globalVariables>
> <declareFunction name="local:debug" tailRecursive="false">
> <literal value="()"/>
> </declareFunction>
> <body>
> <let variable="dosmthg" as="element(oki, {
> http://www.w3.org/2001/XMLSchema}untyped<http://www.w3.org/2001/XMLSchema%7Duntyped>
> )">
> <be>
> <directElement name="oki" validation="skip">
> <valueOf>
> <literal value="test trace" type="xs:string"/>
> </valueOf>
> </directElement>
> </be>
> <return>
> <sequence>
> <functionCall name="local:debug" tailCall="false">
> <variableReference name="dosmthg"/>
> </functionCall>
> <variableReference name="dosmthg"/>
> </sequence>
> </return>
> </let>
> </body>
> </query>
>
> Cheers,
> Rémi
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://x-query.com/pipermail/talk/attachments/20081003/4ddd291d/attachment.htm
More information about the talk
mailing list