But then creating a StringBuffer will result in more wasted space
wouldnt it Chris? Since, if you think about it, your creating one
StringBuffer then writing it's String value out to the Response's
StringBuffer. But I know what you mean about avoiding calls to the IO. (I
had an XML parser/generator that timed in at ~ half of its usually running
time just by skipping all debugging statements!!) Is this a catch 22? :)
        How about using code optimizers like DashO?  That usually speeds up
the code a bit (never tried it in a J2EE environment before. But it
definitely speeds up stand alone Swing Java GUIs). I dont think it actually
effects IO though.
-Tim

-----Original Message-----
From: Christopher K. St. John [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, January 29, 2002 11:15 AM
To: [EMAIL PROTECTED]
Subject: Re: Java Servlet HTML


Anton Tagunov wrote:
>
> out.write("<html>");
> generally results in the string being sent right to the user via
> the underlying socket implementation without any memory allocation.
>

 Premature optimization is the root of all evil :-)

 Most servlet containers buffer by default, see the apidocs
for javax.servlet.Response, specifically setBufferSize(). So
the String will not generally be sent directly to the
underlying socket implementation.

 In any case, if you're concerned with performance, you want
to avoid calls write() (the Java IO code is notoriously slow),
and the best way to do that is with big buffers.

 Making the code awkward in order to save a few bytes of
memory is something that you should only do if you're
really desperate.


--
Christopher St. John [EMAIL PROTECTED]
DistribuTopia http://www.distributopia.com

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to