gcj's IO performance vs blackdown JDK

Christopher Marshall christopherlmarshall@yahoo.com
Wed Dec 3 14:26:00 GMT 2003

--- Bryce McKinlay <bryce@mckinlay.net.nz> wrote:
> On Dec 2, 2003, at 5:07 AM, Christopher Marshall wrote:
> > I have written a lot of programs that process huge text files a line
> > at a time at my work that are 2 to three times slower running under 
> > gcj than running under
> > the JDK and I am pretty sure this I/O issue is the cause.
> >
> > run_benchmark uses Hashgen.java to generate a 100000 line text file 
> > with 1000
> > character lines.  On my machine (433 Mhz celeron dell laptop running 
> > slackware
> > linux 9.0), it takes the JDK 11.1 seconds to run line_count against 
> > the file
> > and it takes the gcj compiled version 34.6 seconds.
> Thanks Christopher, this is a useful test case. I suspect the problem 
> here is our horribly inefficient implementation of 
> BufferedReader.readLine(). Given that it is calling a synchronized 
> read() method in a loop for every character in the stream, I'm 
> surprised its only 3x slower! You might like to have a go at making a 
> more efficient implementation, or alternatively, file an "RFE" bug in 
> bugzilla.
> Cheers
> Bryce.

Thanks for the info.  I suppose I have two choices.  Since I view java primarily as a very useful
programming language, I might just learn how the native interface works, and call the C library

I am, however, intrigued by the possibility of my writing a better BufferedReader.readLine().  I
don't know if I will go the distance and actually finish it, but I will take a look and see if I
can fix it.

Chris Marshall

Do you Yahoo!?
Free Pop-Up Blocker - Get it now

More information about the Java mailing list