<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<META content="MSHTML 6.00.6001.18099" name=GENERATOR></HEAD>
<BODY>
<DIV dir=ltr align=left><SPAN class=885570814-03102008></SPAN><FONT
face=Arial><FONT color=#0000ff><FONT size=2>I<SPAN class=885570814-03102008>
think you ran this with Saxon-B. Saxon-SA does more powerful optimizations,
and produces</SPAN></FONT></FONT></FONT></DIV>
<DIV><FONT face=Arial><FONT color=#0000ff><FONT size=2><SPAN
class=885570814-03102008></SPAN></FONT></FONT></FONT> </DIV>
<DIV><FONT face=Arial><FONT color=#0000ff><FONT size=2><SPAN
class=885570814-03102008><query><BR>
<globalVariables><BR> <declareVariable
name="level"><BR> <literal value="3"
type="xs:integer"/><BR> </declareVariable><BR>
</globalVariables><BR> <declareFunction name="local:debug"
arity="1" tailRecursive="false"><BR> <literal
value="()"/><BR> </declareFunction><BR>
<body><BR> <let variable="dosmthg" as="element(oki,
{http://www.w3.org/2001/XMLSchema}anyType)"><BR>
<be><BR> <directElement
name="oki"
validation="preserve"><BR>
<valueOf><BR>
<literal value="test trace"
type="xs:string"/><BR>
</valueOf><BR>
</directElement><BR>
</be><BR>
<return><BR>
<sequence><BR>
<literal
value="()"/><BR>
<variableReference
name="dosmthg"/><BR>
</sequence><BR>
</return><BR> </let><BR>
</body><BR></query></SPAN></FONT></FONT></FONT></DIV>
<DIV><FONT face=Arial><FONT color=#0000ff><FONT size=2><SPAN
class=885570814-03102008></SPAN></FONT></FONT></FONT> </DIV>
<DIV><FONT face=Arial><FONT color=#0000ff><FONT size=2><SPAN
class=885570814-03102008>One of the optimizations that's done in Saxon-SA but
not in Saxon-B is function inlining.</SPAN></FONT></FONT></FONT></DIV>
<DIV><FONT face=Arial><FONT color=#0000ff><FONT size=2><SPAN
class=885570814-03102008></SPAN></FONT></FONT></FONT> </DIV>
<DIV><FONT face=Arial><FONT color=#0000ff><FONT size=2><SPAN
class=885570814-03102008>Michael Kay</SPAN></FONT></FONT></FONT></DIV>
<DIV><FONT face=Arial><FONT color=#0000ff><FONT size=2><SPAN
class=885570814-03102008><A
href="http://www.saxonica.com/">http://www.saxonica.com/</A></SPAN></FONT></FONT></FONT></DIV>
<DIV dir=ltr align=left><BR></DIV>
<BLOCKQUOTE dir=ltr
style="PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #0000ff 2px solid; MARGIN-RIGHT: 0px">
<DIV class=OutlookMessageHeader lang=en-us dir=ltr align=left>
<HR tabIndex=-1>
<FONT face=Tahoma size=2><B>From:</B> talk-bounces@x-query.com
[mailto:talk-bounces@x-query.com] <B>On Behalf Of </B>Rémi
Dewitte<BR><B>Sent:</B> 03 October 2008 14:17<BR><B>To:</B>
talk@x-query.com<BR><B>Subject:</B> [xquery-talk]
Optimizations<BR></FONT><BR></DIV>
<DIV></DIV>
<DIV dir=ltr>Hi,<BR><BR>I have made a little experiment after reading Michael
(Kay) blog posts about optimizations and recent James Fuller article.<BR><BR>I
have a question quite specific to saxon still interesting in
general.<BR><BR>Why in the following example even the function call is not
skipped ?<BR><BR><BR>XQuery is ::<BR><BR>declare variable $level :=
3;<BR><BR>declare function local:debug($what){<BR> if($level >=4)
then<BR> <debug>{$what}</debug><BR> else
()<BR>};<BR><BR>let $dosmthg := <oki>test
trace</oki><BR><BR>return<BR>(local:debug($dosmthg),$dosmthg)<BR><BR></DIV></BLOCKQUOTE></BODY></HTML>