Hello Christopher!
CKSJ> 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.
>>
CKSJ> Premature optimization is the root of all evil :-)
You can see me through, map! Yes, I'm crazy on optimization and
"premature" optimization is my favourite root of trouble!
CKSJ> Most servlet containers buffer by default, see the apidocs
CKSJ> for javax.servlet.Response, specifically setBufferSize(). So
CKSJ> the String will not generally be sent directly to the
CKSJ> underlying socket implementation.
Yes :)
CKSJ> In any case, if you're concerned with performance, you want
CKSJ> to avoid calls write() (the Java IO code is notoriously slow),
Ooops! I should remember that as a paranoid premature optimizer :)
CKSJ> and the best way to do that is with big buffers.
Chris, I'm really eager to hear more on this!!
CKSJ> Making the code awkward
depends on the point of view: what is more awkward
the StringBuffer or multiple writes? :)
CKSJ> in order to save a few bytes of memory
confess, maybe the next garbage collection really does not happen
much sooner with this one StringBuffer per request..
CKSJ> is something that you should only do if you're
CKSJ> really desperate.
Yes, Chris, I'm really desperate. Always :-)
- Anton
[EMAIL PROTECTED]
[EMAIL PROTECTED]
P.S. Chris, could you plz supply more info on the big/small buffer
IO routines performance?
___________________________________________________________________________
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