<?xml version="1.0" encoding="iso-8859-1"?>
<?xml-stylesheet href="../make-menu.xsl" type="text/xsl"?><html>
   <head>
      <this-is section="using-xsl" page="compiling" subpage=""/>
      <!--
           Generated at 2011-12-09T20:47:22.916Z--><title>Saxonica: XSLT and XQuery Processing: Compiling a Stylesheet</title>
      <meta name="coverage" content="Worldwide"/>
      <meta name="copyright" content="Copyright Saxonica Ltd"/>
      <meta name="title"
            content="Saxonica: XSLT and XQuery Processing: Compiling a Stylesheet"/>
      <meta name="robots" content="noindex,nofollow"/>
      <link rel="stylesheet" href="../saxondocs.css" type="text/css"/>
   </head>
   <body class="main">
      <h1>Compiling a Stylesheet</h1>
      <p>The facility to "compile" a stylesheet to a binary disk representation (the <code>CompileStylesheet</code> command
   and the -c option of <code>net.sf.saxon.Transform</code>) has been dropped with effect from Saxon 9.4.</p>
      <p>Saxon now generates Java bytecode automatically when stylesheets are processed, but the bytecode
   cannot be saved to disk, because it is integrated with interpreted data structures representing the
   executable stylesheet.</p>
      <p>The performance boost achieved by bytecode generation is variable; 25% is typical. The constructs that benefit the
         most are those where the expression tree contains many constructs that are relatively cheap in themselves, such as
         type conversion, comparisons, and arithmetic. This is because the saving from bytecode generation is mainly not in the
         cost of performing primitive operations, but in the cost of deciding which operations to perform: so the saving is greater
         where the number of operations is high relative to their average cost.</p>
      <p>There are configuration options to suppress bytecode generation (<code>FeatureKeys.GENERATE_BYTE_CODE</code>), to
         insert debugging logic into the generated bytecode (<code>FeatureKeys.DEBUG_BYTE_CODE</code>), and to display the generated
         bytecode (<code>FeatureKeys.DISPLAY_BYTE_CODE</code>)</p>
      <p>A new facility for distributing an obfuscated stylesheet is available (this was the main use
   case for compiled stylesheets, since there were negligible performance benefits).
   This is described in the next section.</p>
      <table width="100%">
         <tr>
            <td>
               <p align="right"><a class="nav" href="packaged-xslt.xml">Next</a></p>
            </td>
         </tr>
      </table>
   </body>
</html>