> I'm trying to improve the performance of some Java that someone else
> wrote. This code uses SocketChannel's read() method. I'm considering
[quoted text clipped - 4 lines]
> Is SocketChannel's read() method much more time consuming than
> InputStream's read()?
There is unlikely to be any visible difference whatsoever in the read
operation. How you use the resulting data, though, could yield
performance differences. For example, if you user SocketChannel and
then immediately copy the results from a ByteBuffer into a byte[], then
that copy could be expensive for large amounts of data.
In the end, though, I'd expect that waiting on the socket itself would
swamp any performance issues you'd get in code, unless this is a socket
connected to localhost.

Signature
www.designacourse.com
The Easiest Way To Train Anyone... Anywhere.
Chris Smith - Lead Software Developer/Technical Trainer
MindIQ Corporation
> I'm trying to improve the performance of some Java that someone else
> wrote. This code uses SocketChannel's read() method. I'm considering
> rewriting the code using InputStream (which I know is fast) to improve
> performance.
First things first. Did you run a profiler to confirm this is indeed the
bottleneck in the application? If not, do that first.
/Thomas

Signature
The comp.lang.java.gui FAQ:
ftp://ftp.cs.uu.nl/pub/NEWS.ANSWERS/computer-lang/java/gui/faq
http://www.uni-giessen.de/faq/archiv/computer-lang.java.gui.faq/