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

David Daney ddaney@avtrex.com
Tue Mar 15 00:03:00 GMT 2005


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?

David Daney.
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: bis.patch
URL: <http://gcc.gnu.org/pipermail/java-patches/attachments/20050315/555ae7b3/attachment.ksh>


More information about the Java-patches mailing list