Re: AW: AW: AW: [5.0] JSP performance ...

2003-09-10 Thread Kin-Man Chung

> Date: Wed, 10 Sep 2003 18:34:40 +0200
> From: Remy Maucherat <[EMAIL PROTECTED]>
> Subject: Re: AW: AW: AW: [5.0] JSP performance ...
> To: Tomcat Developers List <[EMAIL PROTECTED]>
> 
> Torsten Fohrer wrote:
> 
> > next try
> 
> Yes, the code is better (IMO) and performs a little better also.
> However, looking more at my profiler, I think the problem with that 
> benchmark is all the not optimized int -> String conversions. Since 
> that's not too useful in the real world (but in that benchmark, it seems 
> extremely important), it is not worth optimizing it right now.
> 
> BTW, for these, Resin generated out.print((var)), assuming the type of 
> the expression would be correct. I think we went through that and 
> decided not to do that, right ?
> 

We did?

I think we should also use out.print(var) instead of
out.write(String.valueOf(var)).  The print methods cover all the types
covered by String.valueOf, so there is really no advantage in using
out.write's.  Using print lets javac resolves the object types at
compile time instead of runtime, and should be faster.

If there is no objections, I'll go ahead and make the change.

- Kin-man

> I think we would need to define a decent servlet&JSP bench suite :) (and 
> avoid to rig it)
> 
> Remy
> 
> 
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: AW: AW: AW: [5.0] JSP performance ...

2003-09-10 Thread Remy Maucherat
Torsten Fohrer wrote:

next try
Yes, the code is better (IMO) and performs a little better also.
However, looking more at my profiler, I think the problem with that 
benchmark is all the not optimized int -> String conversions. Since 
that's not too useful in the real world (but in that benchmark, it seems 
extremely important), it is not worth optimizing it right now.

BTW, for these, Resin generated out.print((var)), assuming the type of 
the expression would be correct. I think we went through that and 
decided not to do that, right ?

I think we would need to define a decent servlet&JSP bench suite :) (and 
avoid to rig it)

Remy



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


AW: AW: AW: [5.0] JSP performance ...

2003-09-10 Thread Torsten Fohrer
next try


-Ursprüngliche Nachricht-
Von: Torsten Fohrer [mailto:[EMAIL PROTECTED]
Gesendet: Dienstag, 9. September 2003 13:55
An: 'Tomcat Developers List'
Betreff: AW: AW: AW: [5.0] JSP performance ...



patched a snapshot to merge template text nodes.

I implement following using a additional visitor in Generator.java
 - char[] arrays for templatetexts
 - same templatetexts -> only 1 char array for text, better without merging

good/bad gimmicks: 
  - removing empty templatetexts, example: only \r\n, "", null and so
  - removing \r\n after scripting elements

One effect, i see is a lower memory usage from jasper pages 

cu Torsten Fohrer

-Ursprüngliche Nachricht-
Von: Remy Maucherat [mailto:[EMAIL PROTECTED]
Gesendet: Dienstag, 9. September 2003 11:31
An: Tomcat Developers List
Betreff: Re: AW: AW: [5.0] JSP performance ...


Torsten Fohrer wrote:

> what's about char[] array/string reusing?
> Create only a char array for each unique templatetext node. 
> 
> -> 
>   10 x char[] jspx_text_1 = "something\n";
>   1  x char[] jspx_text_1 = "something\n";

Won't the VM do that internally ?
Since apparently you have examined that issue in detail already, maybe 
you can give more details :)

- What exactly did you implement ?
- What's the code it generates ? Does it also merge the TemplateText nodes ?
- Did it improve performance ? For example, if you try to run the test I 
gave, what kind of performance increase do you see ?

Remy



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




package org.apache.jsp;

import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.jsp.*;
import java.util.*;

public final class h2000_jsp extends org.apache.jasper.runtime.HttpJspBase
implements org.apache.jasper.runtime.JspSourceDependent {

  private char[] _jspx_textLine_1 = "".toCharArray();
  private char[] _jspx_textLine_2 = "".toCharArray();
  private char[] _jspx_textLine_3 = "\r\n".toCharArray();
  private char[] _jspx_textLine_4 = "\r\n ".toCharArray();
  private char[] _jspx_textLine_5 = "\r\n   ".toCharArray();
  private char[] _jspx_textLine_7 = "".toCharArray();
  private char[] _jspx_textLine_8 = "".toCharArray();
  private char[] _jspx_textLine_9 = "\r\n   ".toCharArray();
  private char[] _jspx_textLine_10 = "\r\n ".toCharArray();
  private char[] _jspx_textLine_11 = "\r\n".toCharArray();
  private char[] _jspx_textLine_12 = " Hello World Hello World Hello World Hello World 
Hello World Hello World Hello World Hello World Hello World Hello World 
".toCharArray();
  private char[] _jspx_textLine_13 = " Hello World Hello World Hello World Hello World 
Hello World Hello World Hello World Hello World Hello World Hello World \r\n  
".toCharArray();
  private char[] _jspx_textLine_14 = "\r\n".toCharArray();

  private static java.util.List _jspx_dependants;

  public java.util.List getDependants() {
return _jspx_dependants;
  }

  public void _jspService(HttpServletRequest request, HttpServletResponse response)
throws java.io.IOException, ServletException {

JspFactory _jspxFactory = null;
PageContext pageContext = null;
ServletContext application = null;
ServletConfig config = null;
JspWriter out = null;
Object page = this;
JspWriter _jspx_out = null;


try {
  _jspxFactory = JspFactory.getDefaultFactory();
  response.setContentType("text/html");
  pageContext = _jspxFactory.getPageContext(this, request, response,
null, false, 8192, true);
  application = pageContext.getServletContext();
  config = pageContext.getServletConfig();
  out = pageContext.getOut();
  _jspx_out = out;

  out.write( _jspx_textLine_1 );
  out.write(String.valueOf( request.getParameter("title") ));
  out.write( _jspx_textLine_3 );
 
// build tight loop table with array data, multidimensional 5x6
String array[] = { "Hello", "World", "2000", "Hello", "World", "2000" };
Arrays.sort(array);
String multi[][] = { array, array, array, array, array };

  out.write( _jspx_textLine_4 );
 for(int row=0; row < multi.length; row++) { 
  out.write( _jspx_textLine_5 );
  out.write(String.valueOf( (row % 2) == 1 ? "gray" : "white" ));
  out.write( _jspx_textLine_6 );
 for(int col=0; col < array.length; col++) { 
  out.write( _jspx_textLine_7 );
  out.write(String.valueOf( multi[row][col] ));
  out.write( _jspx_textLine_9 );
 } 
  out.write( _jspx_textLine_10 );
 } 
  out.write( _jspx_textLine_11 );
 
String dummy = request.getParameter("integer"

Re: AW: AW: AW: [5.0] JSP performance ...

2003-09-09 Thread Jeff Tulley
Torsten,
   Your attachment didn't come through. (Common mistake, I've made it dozens of 
times).  Rename the file as .txt, that should work.

Jeff Tulley  ([EMAIL PROTECTED])
(801)861-5322
Novell, Inc., The Leading Provider of Net Business Solutions
http://www.novell.com

>>> [EMAIL PROTECTED] 9/9/03 5:55:27 AM >>>

patched a snapshot to merge template text nodes.

I implement following using a additional visitor in Generator.java
 - char[] arrays for templatetexts
 - same templatetexts -> only 1 char array for text, better without merging

good/bad gimmicks: 
  - removing empty templatetexts, example: only \r\n, "", null and so
  - removing \r\n after scripting elements

One effect, i see is a lower memory usage from jasper pages 

cu Torsten Fohrer

-Ursprüngliche Nachricht-
Von: Remy Maucherat [mailto:[EMAIL PROTECTED] 
Gesendet: Dienstag, 9. September 2003 11:31
An: Tomcat Developers List
Betreff: Re: AW: AW: [5.0] JSP performance ...


Torsten Fohrer wrote:

> what's about char[] array/string reusing?
> Create only a char array for each unique templatetext node. 
> 
> -> 
>   10 x char[] jspx_text_1 = "something\n";
>   1  x char[] jspx_text_1 = "something\n";

Won't the VM do that internally ?
Since apparently you have examined that issue in detail already, maybe 
you can give more details :)

- What exactly did you implement ?
- What's the code it generates ? Does it also merge the TemplateText nodes ?
- Did it improve performance ? For example, if you try to run the test I 
gave, what kind of performance increase do you see ?

Remy



-
To unsubscribe, e-mail: [EMAIL PROTECTED] 
For additional commands, e-mail: [EMAIL PROTECTED] 





-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



AW: AW: AW: [5.0] JSP performance ...

2003-09-09 Thread Torsten Fohrer

patched a snapshot to merge template text nodes.

I implement following using a additional visitor in Generator.java
 - char[] arrays for templatetexts
 - same templatetexts -> only 1 char array for text, better without merging

good/bad gimmicks: 
  - removing empty templatetexts, example: only \r\n, "", null and so
  - removing \r\n after scripting elements

One effect, i see is a lower memory usage from jasper pages 

cu Torsten Fohrer

-Ursprüngliche Nachricht-
Von: Remy Maucherat [mailto:[EMAIL PROTECTED]
Gesendet: Dienstag, 9. September 2003 11:31
An: Tomcat Developers List
Betreff: Re: AW: AW: [5.0] JSP performance ...


Torsten Fohrer wrote:

> what's about char[] array/string reusing?
> Create only a char array for each unique templatetext node. 
> 
> -> 
>   10 x char[] jspx_text_1 = "something\n";
>   1  x char[] jspx_text_1 = "something\n";

Won't the VM do that internally ?
Since apparently you have examined that issue in detail already, maybe 
you can give more details :)

- What exactly did you implement ?
- What's the code it generates ? Does it also merge the TemplateText nodes ?
- Did it improve performance ? For example, if you try to run the test I 
gave, what kind of performance increase do you see ?

Remy



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]