Nevermind -- I examined other classes produced with 1.5 specified. These were compiled for 1.5 (version 49.0 byte code).

On another ugly JSP, I note:

   * Tomcat 6 - JDT targeting 1.5: 93K
   * Tomcat 7 - JDT targeting 1.6: 149K
   * Tomcat 7 - JDT targeting 1.5: 133K
   * Tomcat 7 - javac (externally from command line) targeting 1.6: 118K
   * Tomcat 7 - javac (externally from command line) targeting 1.5: 68K
   * Tomcat 7 - JDT targeting 1.5 with debug off and smap suppressed: 68K

Clearly there's normally extra expense for debug/smap information, though it's not clear to me whether this works against the 65K limit or not.

Note the last 2 results are essentially identical (I didn't compare byte counts).

Yet when I try this last configuration with the JSP that goes over 65K it fails with JDT and succeeds with javac.

--
Jess Holle

On 3/12/2011 9:50 AM, Jess Holle wrote:
On 3/11/2011 6:04 AM, Jess Holle wrote:
On 3/11/2011 3:22 AM, Mark Thomas wrote:
The obvious difference is that Tomcat 6 compilation targets Java 5
whereas Tomcat 7 targets Java 6. For a simple test JSP:
Tomcat 6 (1.5) - 3,488
Tomcat 7 (1.5) - 3,530 +1%
Tomcat 7 (1.6) - 3,668 +6%

The 1% will be a combination of:
- Tomcat 7 uses version 3.6 of the Eclipse compiler while Tomcat 6 uses
3.3.1.
- the source code differences you can see in the .java files.
Hmm....

I tried forcing 1.5 as the source/target version for JspC -- I'm still over 65K with Tomcat 7.

I wonder if there's enough extra hidden code generated by use of generics...

Anyway, I guess the page owners will have to try to clean things up.
Is it possible that the source/target version is being ignored, e.g. for the Ant task form of JspC?

I ask as javac fails to compile the Java code generated by jasper as well for the same reason -- the _jspService method is too big. When I force 1.5 as the target and source version, however, javac compiles the generated Java code just fine.

When I try the same trick with my precompilation Ant script, however, ala

<jasper2 uriroot="${docBaseLocation}" classpath="${wcWebAppClasspathAsString}"
             compile="true" outputDir="${outputDir}"
             classDebugInfo="true" smapSuppressed="${smapSuppressed}"
             compilerSourceVM="1.5" compilerTargetVM="1.5"
             validateXml="false" listErrors="true"
             verbose="${jspcVerbosityLevel}" jspFiles="${jspFileList}"/>

I still get the same failure, which seems rather odd. You'd think that JDT/EJC can't be generating that much larger code than javac.

--
Jess Holle


Reply via email to