This is the mail archive of the
java-patches@gcc.gnu.org
mailing list for the Java project.
java.io fix and speedup
- From: Mark Wielaard <mark at klomp dot org>
- To: java-patches at gcc dot gnu dot org
- Date: 03 Jan 2003 00:13:53 +0100
- Subject: java.io fix and speedup
- Organization:
Hi,
The following fixes a small issue in FileInputStream. When
FileInputStream was finalized it would also force the finalization of
the underlying FileDescriptor. But the FileDescriptor could have been
shared with other FileInputStreams or RandomAccessFiles. The patch makes
the behaviour the same as for FileOutputStream.finalize(), which means a
noop. It also makes FileDescriptor a little bit more efficient by making
less system calls. (I only changed the Posix version.) This gives me a
small (~1%) speedup in IO intensive programs.
2003-01-02 Mark Wielaard <mark@klomp.org>
* java/io/FileInputStream.java (finalize): Don't explicitly
finalize FileDescriptor.
* java/io/FileDescriptor.java (position): New private field.
* java/io/natFileDescriptorPosix.cc (write): Up position.
(setLength): Use and set position.
(seek): Set position.
(getFilePointer): Return position.
(read): Up position.
OK for branch and mainline?
Cheers,
Mark