JIT compilation of template rules
Sometimes a stylesheet may contain hundreds of template rules to define the processing of elements that are rarely used in source documents; many source documents might use a tiny fraction of the defined vocabulary. In this situation, it is wasteful to compile all these template rules every time the stylesheet is used. This isn't a problem when the stylesheet is compiled once, cached, and used to run a large number of transformations; but it is a problem in a batch workflow where the stylesheet is compiled every time it is used.
To improve the efficiency of this kind of workload, Saxon-EE by default uses just-in-time compilation of template rules. On first reading the stylesheet, all the match patterns are processed and a suitable decision table is constructed; but the body of a template rule is not compiled into executable form until the first time that template rule is matched.
A consequence of this is that static errors (for example, invalid path expressions) in such templates may go undetected if the code is not actually executed.
JIT compilation is enabled by default. It can be suppressed from the command line by setting -jit:off
.
Setting the export
, explain
, or nogo
options also has the side-effect
of suppressing JIT compilation. There is also an option available on the XsltCompiler
object.
It probably makes sense to suppress JIT compilation in any workload where the compiled stylesheet is cached and used repeatedly.