> Date: Tue, 09 Sep 2003 08:59:51 +0200 > From: Remy Maucherat <[EMAIL PROTECTED]> > Subject: Re: AW: [5.0] JSP performance ... > To: Tomcat Developers List <[EMAIL PROTECTED]> > > Kin-Man Chung wrote: > > I have implemented generating text strings as char arrays, with a > > compiler option to turn it on and off, and did some timings on the > > benchmark. Just as I suspected, the benchmark did not show much > > performance difference, when the option was turned on and then off. > > > > Now I am wondering if there is any value in committing my change. :( > > Well, if it does improve results, it can't hurt, but the two should > likely be similar. What did you get in your testing ?
I ran your Jsp page with added timings. The difference in the numbers with the option switched on and off is less the time flutuation itself. > I think what should be optimized is that there's twice the amount of writes. > Looking at the code generated, this situation seems rather common. So > the idea would be to do a pass to merge all those TemplateText nodes :) > I'll try that next, but don't get your hope up. It may not change much. > The profile showed about 75% of the CPU was spent in the JSP service (as > usual with the VM profiles, it's probably misleading), and probably some > of that time comes from the fact it has to invoke hundreds of methods. > Method calls should be cheap. The question is: is writng a String of size 1000 much faster than writing 10 Strings each of size 100? -Kin-man > Remy > > >>I took a look at o.a.j.runtime.JspWriterImpl and the methods > >> > >> write(String s, int off, int len) > >>and > >> write(char cbuf[], int off, int len) > >> > >>in particualr, and failed to see any performance gain of the 2nd over the > >>first. They are very similar, the only different is that the first uses > >>String.getChars while the second uses System.arraycopy, but those two > >>methods should be on par in terms of performance. That is, I don't see > >>any extra unnecessary copies. > >> > >>Perhasp the culprit is those extra writes? > >> > >>-Kin-man > > > --------------------------------------------------------------------- > 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]