Java Mailing List Archive

http://www.junlu.com/

Home » Home (12/2007) » Tomcat Users »

PrintWriter performance

Rostislav Svoboda

2004-05-25

Replies:

Hi all

I'd like to ask you if there's a significant difference in performance between:

  PrintWriter out = response.getWriter();
  String ret = "";
  for (count = 0; rs.next(); count++)
    ret += rs.getString("column_name");      // result of db query
  out.print(ret);
  out.close();
 
and:

  PrintWriter out = response.getWriter();
  for (count = 0; rs.next(); count++)
    out.print(rs.getString("column_name");    // result of db query
  out.close();

I know I have the extra string which is (theoretically) a slow-down but I don't
know anything about the way how tomcat handles with large strings (in my
case about 1MB), if is there any limited buffering etc.

I know as well I can test it by myself very easilly but I hope someone's
gonna give me a bit of explanation along with 20 funny stories etc. :)

EOF & thx

Bost

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@(protected)
For additional commands, e-mail: tomcat-user-help@(protected)

©2008 junlu.com - Jax Systems, LLC, U.S.A.