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: java.io fix and speedup


Hi,

On Fri, 2003-01-03 at 17:58, Tom Tromey wrote:
> >>>>> "Mark" == Mark Wielaard <mark@klomp.org> writes:
>
> Mark> * java/io/FileDescriptor.java (position): New private field.
> Mark> * java/io/natFileDescriptorPosix.cc (write): Up position.
> Mark> (setLength): Use and set position.
> Mark> (seek): Set position.
> Mark> (getFilePointer): Return position.
> Mark> (read): Up position.
> 
> With this part, what if two processes are modifying the same file at
> the same time?  I suppose even the current code has problems in that
> situation.  Is the performance of setLength and seek important?

The java.io API does not give any guarantees in that case anyway (it is
not even guaranteed to be thread safe). Especially seek was a bit
inefficient in the old code since it called both length() and
getFilePosition() unconditionally, even when it was not necessary, which
resulted in three system calls for every seek. Seek is an operation you
do quite often with RandomAccessFiles. But the speedup wasn't that big
and not that important. If the mmap patch from Jeff is useable in
general then that would give us much bigger improvements.

Cheers,

Mark


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