You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-users@xalan.apache.org by Brian Minchau <mi...@ca.ibm.com> on 2007/09/20 08:12:05 UTC

Is turning off XSLTC template by default inlining OK ?

There are three pending issues before Apache Xalan-J 2.7.1 goes into
test/build/distribute mode:

XALANJ-2206
XALANJ-2395
XALANJ-1243

The PMC has voted for the release 2.7.1, allowing for a few last moment
fixes to get in, and those 3 are the fixes.
I'm fine with 2395 and 1243 and am personally responsible for reviewing
2206.

The problem is with 2206. Before this patch org.apache.xalan.xsltc.compiler
.Stylesheet had a default value for the field _templateInlining of "true",
and you couldn't actually set a non-default value.

With the patch you can set it, but the patch in 2206 also has the default
value as false. I have no concerns about the patch in particular, just the
default value. Although one nomally doesn't do optimization by default,  If
the default value is false I think that a number of users/customers would
experience a performance degredation with 2.7.1.

Does anyone know whether the default value for template inlining must be
false?



- Brian Minchau


Re: Is turning off XSLTC template by default inlining OK ?

Posted by ke...@us.ibm.com.
I agree that the default for a new switch should probably be "the way it
used to work before the switch was added" unless the new mode will be an
improvement for most users. Defaulting to performance mode rather than
debugging (I assume) mode makes sense to me. Second the motion to make this
one default to true.

______________________________________
"... Three things see no end: A loop with exit code done wrong,
A semaphore untested, And the change that comes along. ..."
  -- "Threes" Rev 1.1 - Duane Elms / Leslie Fish
(http://www.ovff.org/pegasus/songs/threes-rev-11.html)

Re: Is turning off XSLTC template by default inlining OK ?

Posted by Henry Zongaro <zo...@ca.ibm.com>.
Hi, Brian.

Brian Minchau/Toronto/IBM@IBMCA wrote on 2007-09-20 02:12:05 AM:
> The problem is with 2206. Before this patch 
org.apache.xalan.xsltc.compiler
> .Stylesheet had a default value for the field _templateInlining of 
"true",
> and you couldn't actually set a non-default value.

That's not quite true.  There is a Stylesheet.setTemplateInlining(boolean) 
method, which the ApplyImports, Import, Include, and most importantly, the 
XSLTC class all reference.  The XSLTC class in particular uses the value 
of its own _templateInlining field, which has a default setting of false, 
when it calls Stylesheet.setTemplateInlining from 
XSLTC.compile(InputSource,String)

If template inlining attribute has been set to true on XSLTC's 
TransformerFactoryImpl class, the newTemplates method of XSLTC's 
TransformerFactoryImpl class passes the setting of that flag to the XSLTC 
class.  The newTemplates method is used in the implementations of the 
newTransformer and newXMLFilter methods.  So through any of those 
mechanisms, the XSLTC and Stylesheet classes will have template inlining 
set to true if it was set to true on the TransformerFactory, and false 
otherwise.

However, the XSLTC TemplatesHandler implementation does not pass through 
TransformerFactory.newTemplates to compile the stylesheet and it doesn't 
pass throught XSLTC.compile(InputSource,String).  When the 
TemplatesHandler is created, it creates an XSLTC instance, but the setting 
of the TransformerFactory's template inlining attribute never makes it to 
the XSLTC object, and the setting on the XSLTC object never makes it to 
the Stylesheet.  So it remains stuck at "true" in the Stylesheet object.

> With the patch you can set it, but the patch in 2206 also has the 
default
> value as false. I have no concerns about the patch in particular, just 
the
> default value. Although one nomally doesn't do optimization by default, 
If
> the default value is false I think that a number of users/customers 
would
> experience a performance degredation with 2.7.1.
> 
> Does anyone know whether the default value for template inlining must be
> false?

Yes, it should be false.  That's really the default value today.  Setting 
it to true results in methods that are potentially very large, because all 
templates are inlined in the main applyTemplates method generated in the 
translet.  If the Java run-time has a just-in-time compiler, it can do a 
much better job of deciding which templates ought to be inlined where 
based on actual run-time profiling information.

I believe the patch is correct.

Thanks,

Henry
------------------------------------------------------------------
Henry Zongaro      XSLT Processors Development
IBM SWS Toronto Lab   T/L 969-6044;  Phone +1 905 413-6044
mailto:zongaro@ca.ibm.com


Re: Is turning off XSLTC template by default inlining OK ?

Posted by Henry Zongaro <zo...@ca.ibm.com>.
Hi, Brian.

Brian Minchau/Toronto/IBM@IBMCA wrote on 2007-09-20 02:12:05 AM:
> The problem is with 2206. Before this patch 
org.apache.xalan.xsltc.compiler
> .Stylesheet had a default value for the field _templateInlining of 
"true",
> and you couldn't actually set a non-default value.

That's not quite true.  There is a Stylesheet.setTemplateInlining(boolean) 
method, which the ApplyImports, Import, Include, and most importantly, the 
XSLTC class all reference.  The XSLTC class in particular uses the value 
of its own _templateInlining field, which has a default setting of false, 
when it calls Stylesheet.setTemplateInlining from 
XSLTC.compile(InputSource,String)

If template inlining attribute has been set to true on XSLTC's 
TransformerFactoryImpl class, the newTemplates method of XSLTC's 
TransformerFactoryImpl class passes the setting of that flag to the XSLTC 
class.  The newTemplates method is used in the implementations of the 
newTransformer and newXMLFilter methods.  So through any of those 
mechanisms, the XSLTC and Stylesheet classes will have template inlining 
set to true if it was set to true on the TransformerFactory, and false 
otherwise.

However, the XSLTC TemplatesHandler implementation does not pass through 
TransformerFactory.newTemplates to compile the stylesheet and it doesn't 
pass throught XSLTC.compile(InputSource,String).  When the 
TemplatesHandler is created, it creates an XSLTC instance, but the setting 
of the TransformerFactory's template inlining attribute never makes it to 
the XSLTC object, and the setting on the XSLTC object never makes it to 
the Stylesheet.  So it remains stuck at "true" in the Stylesheet object.

> With the patch you can set it, but the patch in 2206 also has the 
default
> value as false. I have no concerns about the patch in particular, just 
the
> default value. Although one nomally doesn't do optimization by default, 
If
> the default value is false I think that a number of users/customers 
would
> experience a performance degredation with 2.7.1.
> 
> Does anyone know whether the default value for template inlining must be
> false?

Yes, it should be false.  That's really the default value today.  Setting 
it to true results in methods that are potentially very large, because all 
templates are inlined in the main applyTemplates method generated in the 
translet.  If the Java run-time has a just-in-time compiler, it can do a 
much better job of deciding which templates ought to be inlined where 
based on actual run-time profiling information.

I believe the patch is correct.

Thanks,

Henry
------------------------------------------------------------------
Henry Zongaro      XSLT Processors Development
IBM SWS Toronto Lab   T/L 969-6044;  Phone +1 905 413-6044
mailto:zongaro@ca.ibm.com