-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Michael,

On 2/17/2010 3:59 AM, Michael Heinen wrote:
> I patched org.apache.jasper.compiler.Generator and removed the
> AnnotationHelper.
> The compiled jsps did not contain these calls anymore but this did
> not have any noticeable effect on performance.

Hmm.

> I did some more tests with Tomcat and Jetty:
> 1) 100 outputtags:      Tomcat: 3ms   Jetty: 3ms
> 2) 1000 outputtags:   Tomcat 72ms  Jetty 41ms
> 3) 2000 outputtags:   Tomcat 190ms  Jetty 174ms   

Interesting. Would you mind extending that testing to 3, 4, 5, and 10
thousand tags? I wonder if you're experiencing some startup cost that
Tomcat incurs by trying to aggressively optimize some special case, and
that Tomcat's performance will roughly equal Jetty's at some point.

> Both servers were started with same jdk and same vm params.

So, both Jetty and Tomcat, same versions, same environment, different
JSF revision. Can you compare the compiled .java files on Tomcat between
JSF 1.1 and JSF 1.2? I suspect you'll get roughly the same code in both
cases. If that's true, the problem is in JSF, not in Tomcat.

Or, does Tomcat supply the JSF implementation? That doesn't sound right.

> Another difference between the compiled jsps are value expressions:
> Tomcat JSF 1.2:
> _jspx_th_h_005foutputText_005f999.setValue(new 
> org.apache.jasper.el.JspValueExpression("/1000hout.jsp(1021,0) 
> '1'",_el_expressionfactory.createValueExpression("1",java.lang.Object.class)));
> _jspx_th_h_005foutputText_005f999.setStyle(new 
> org.apache.jasper.el.JspValueExpression("/1000hout.jsp(1021,0) 'z 
> index:29202;'",_el_expressionfactory.createValueExpression("z-index:29202;",java.lang.Object.class)));
>    
> Jetty JSF 1.2
> _jspx_th_h_outputText_999.setValue(org.apache.jasper.runtime.PageContextImpl.getValueExpression("1",
>  (PageContext)_jspx_page_context, java.lang.Object.class, null));
> _jspx_th_h_outputText_999.setStyle(org.apache.jasper.runtime.PageContextImpl.getValueExpression("z-index:29202;",
>  (PageContext)_jspx_page_context, java.lang.Object.class, null));
> 
> Tomcat JSF 1.1 (for completeness):
> _jspx_th_h_005foutputText_005f999.setValue("1");
> _jspx_th_h_005foutputText_005f999.setStyle("z-index:29202;");

This could be the issue: when using JSF 1.1, Tomcat's compiler somehow
figures out that the values you're passing-in are constants, and doesn't
bother with the JspValueExpression. That avoids at least one object
allocation, at least 2 method calls, and probably a lot of parsing and
time wasted evaluating an expression that doesn't really need an evaluation.

It's funny that this doesn't happen all the time: it would be a great
performance optimization to scan these values for EL expressions during
compilation and avoid all this junk in the first place.

Anyhow, the only thing I can think of is that the "value" and "style"
attributes in 1.1 weren't supposed to be EL expressions (or maybe they
were, and this was a bug or something) and now, in 1.2, they /are/ EL
expressions, causing the translation from JSP -> Java source to become
more complicated because the expressions might need to be evaluated.

What does Jetty's compiled code for 1.1 look like in this area?

> I did not find any hotspots >3% in the sample with 1000 tags. I tried
> to nail down the performance problem we are seeing in our real app
> but this seems to be not so trivial.

The code is probably performing just fine... it's just that parsing and
evaluating expressions is a time-consuming business.

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAkt8CMYACgkQ9CaO5/Lv0PCEcQCfVH5xmFdLXx7mSq+XiRAUvqaG
+JEAnjK4fEHbZVOzCYEDBE0pvMbx/7/u
=eaFX
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Reply via email to