[xquery-talk] Optimizations

Michael Kay mike at saxonica.com
Fri Oct 3 16:14:27 PDT 2008

I think you ran this with Saxon-B. Saxon-SA does more powerful
optimizations, and produces
    <declareVariable name="level">
      <literal value="3" type="xs:integer"/>
  <declareFunction name="local:debug" arity="1" tailRecursive="false">
    <literal value="()"/>
    <let variable="dosmthg" as="element(oki,
        <directElement name="oki" validation="preserve">
            <literal value="test trace" type="xs:string"/>
          <literal value="()"/>
          <variableReference name="dosmthg"/>
One of the optimizations that's done in Saxon-SA but not in Saxon-B is
function inlining.
Michael Kay


From: talk-bounces at x-query.com [mailto:talk-bounces at x-query.com] On Behalf
Of Rémi Dewitte
Sent: 03 October 2008 14:17
To: talk at x-query.com
Subject: [xquery-talk] Optimizations


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
  else ()

let $dosmthg := <oki>test trace</oki>


-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://x-query.com/pipermail/talk/attachments/20081003/c7c4e0b3/attachment.htm

More information about the talk mailing list