This is the mail archive of the java-patches@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [Patch] Optimizations for java.io.BufferedInputStream...


David Daney wrote:

The current skip(int) implementation of BufferedInputStream reads and ignores data from the underlying stream. We have a program that creates a BufferedInputStream on an underlying FileInputStream where the file is on a network mounted file system. Often we skip large portions of the streams. This causes the entire contents of the files to be transfered even when we only are interested in a small portion near the end.

This patch does two things:

1) skip now calls skip on the underlying stream when possible (i.e. The internal buffer is empty and there is no mark).

2) Access the underlying stream directly instead of calling supper.some_method(). This saves a method call for each operation.

Tested on the HEAD on i686-pc-linux with make check in libjava with no regresions. No regresions in mauve in the 4.0 branch (HEAD not tested in mauve due to ICE in mauve)

2005-03-14 David Daney <ddaney@avtrex.com>

    * java/io/BufferedInputStream.java (available): Use 'in' instead
    of 'super' for underlying stream access.
    (close): Ditto.
    (read(byte[], int, int)): Ditto.
    (refill): Ditto.
    (skip): Call skip on underlying stream when possible.

O.K to commit to HEAD?

How about the 4.0 branch for good measure?


Yes, this looks good, thanks! I think this is OK for 4.0 too.


However: this patch needs to also go into classpath as BuffereredInputStream is merged (almost). It would be great if you could get yourself a classpath CVS account and check it in there too.

Regards

Bryce


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]