Kevin Conaway <kevin.conaway <at> gmail.com> writes:

> 
> I don't know of a reason why it doesn't do buffered reads.  I do know that the
Reader interface is designed for working with characters whereas the InputStream
interface is designed for working with bytes.Can you recompile with an
implementation that does buffered reads and see if that solves your
issues?KevinOn Tue, Oct 7, 2008 at 6:36 PM, Aaron <dirtyvagabond <at> yahoo.com>
wrote:Hi Restlet Community,
> We've been doing some performance profiling of our system, which uses
> Restlet 1.1-M4 to handle resquests. We noticed that
> org.restlet.util.ByteUtils.toString(Reader) is costing us about 40% of
> our runtime.
> We took a peek at the source code and realized this method is reading in
> the payload character-by-character. So this method also stands out in our
> profile in terms of invocation count on java.lang.StringBuilder.append()...
> we see literally millions of calls to append() since it's making a call per
> character of payload.
> So we're wondering if it might be better for this to create a very large
> buffer and read everything into that at once? Also, is there a reason that
> it's dealing with characters rather than bytes?
> Many thanks for any insights into this...!
> Best wishes,Aaron


Hi Kevin,

We've tried a basic char buffer approach which seems to speed it up
dramatically. So we'll probably run with that. I was still curious to hear any
community feedback, and perhaps see if this might be something the core team
would find it worthwhile to investigate.


Reply via email to