Quercus: Interpreted, compiled, and lazy

From Resin 3.0

Jump to: navigation, search

Quercus executes code in two modes, interpreted and compiled, and a third combination of the two which is `lazy'

The default behaviour is `lazy', which means that when a script is first used it runs in interpreted mode and compilation is started in the background. As soon as the compilation is finished Quercus will switch over to using the compiled version.

This means that there are two code paths, one that applies for interpreted and one for compiled. Often the first request made of an application will be in interpreted mode, and by the time the second request is received the compialtion is complete and the compiled mode is used.

You can control the compilation behaviour with the `compile' configuration of the QuercusServlet:

 <servlet-mapping url-pattern="*.php"
                  servlet-class="com.caucho.quercus.servlet.QuercusServlet">
   <init compile="false"/>
 </servlet-mapping>

The valid values of `compile' are `true', `false', and `lazy' (the default).

Compiled mode

Quercus creates .java source files, and then uses the java compiler to compile the source to .class files. The intermediate java files are stored in WEB-INF/_work/_quercus.

Personal tools