users@glassfish.java.net

Re: Compiling JSP is slow on v3

From: <glassfish_at_javadesktop.org>
Date: Fri, 03 Sep 2010 18:08:19 PDT

Thanks Per, for taking the time to get the numbers for me!

The "Generated" times are the times spent in compiling the JSP files to Java files, while the "Compiled" times are those spent in javac, comiling Java files to class files. There are a couple of things to remember when looking at the numbers.

1. The first "Compiled" time is always big, since it takes time to startup javac. Subsequent javac compilations should be much faster. Try redeploy your app again, and see the numbers go down.

2. The "Generated" time for a jsp file actually includes the time it takes (Generated and Compiled) to compile all the dependent tag files. That why the generated time for login.jsp and home.jsp is large, probably because they reference tag files which may in term reference other tag files.

I have done some measurements on the compilation times on v2 and v3. My test case is a simple jsp files that reference another simple tag files:

bra.jsp:

<%@ taglib prefix="test" tagdir="/WEB-INF/tags" %>

begin <br/>
<test:brack>
  <test:brack>
    qwertyui
  </test:brack>
</test:brack>
<br/>
end <br/>

brack.tag:
[== <jsp:doBody/> ==]

I got the following times:

                               | v2 initial | v2 redeploy | v3 initial | v3 redeploy |
G time brack.tag | 15 | 1 | 18 | 1 |
C time brack.tag | 759 | 86 | 1337 | 159 |
G time bra.jsp | 895 | 94 | 1771 | 176 |
C time bra.jsp | 83 | 75 | 171 | 161 |

Several things are obvious:

1. G time for bra.jsp is greater than G and C times for brack.tag because the times in brack.tag are included.

2. The times after redeploy are much less than the initial time.

3. V3 times are larger than V2 times, like you all said. But not as bad as I was led to believe. I can probably explain why javac take more time in V3: it has now more jar files in javac classpath. There are now over 250 of them!

I'll certainly look into this more, to see where why JSP compilation is slower in V3. It would great if you can give your test case. It doesn't have to run, just needs to able to compile. Thanks.
[Message sent by forum member 'kchung']

http://forums.java.net/jive/thread.jspa?messageID=481859