This is definitely not offtopic..On the contrary..it has been very much
informative..Thanks
> ----------
> From: Nic Ferrier[SMTP:[EMAIL PROTECTED]]
> Reply To: A mailing list for discussion about Sun Microsystem's Java
> Servlet API Technology.
> Sent: Friday, June 16, 2000 9:05 AM
> To: [EMAIL PROTECTED]
> Subject: Re: Using write(byte[]) instead of println(String) yields a
> nice performance increase
>
> > out.write(html.getBytes());
> > makes this code MUCH faster. Specifically, I observed
>
> I forgot some important things:
>
> Some OutputStream implementations overload OutputStream instead of
> FilterOutputStream.
>
> FilterOutputStream does much the same thing as my
> LowImpedanceStream.
>
>
> When you examine implementations of OutputStream you will see that
> methods like:
>
> public void write(byte[] b,int start,int length)
>
> are implemented by calling:
>
> this.write(int)
>
> with each byte.
>
> You can tell that this is how it's done by looking at the JavaDoc -
> the OutputStream class has only one abstract method from outputing
> data - write(int); therefore all the other methods must be implemented
> in terms of that.
>
> You will note that ServletOutputStream extends OutputStream and thus
> recieves the poor implementaton of the bulk output methods.
>
>
> Thus unless a servlet container provides an implementation of
> ServletOutputStream which overloads the bulk output methods of
> OutputStream the implementation will always be slow.
>
>
>
> One last important thing. The original post was prompted by a
> question involving writing Strings to the output.
>
> Don't use the getOutputStream() in this circumstance - use the
> getWriter().
>
> getWriter() returns a PrintWriter which has better performance
> printing Strings. Check the JavaDoc to see if you can work out why.
>
> PrintWriter *can* also handle different character-encodings. If your
> servlet container is clever it might setup the correct encoding for
> you.
>
>
> Right - I'll shut up about that now. Sorry for the slightly off-topic
> nature.
>
>
> Nic Ferrier
>
> __________________________________________________________________________
> _
> 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