gcj's IO performance vs blackdown JDK
Mohan Embar
gnustuff@thisiscool.com
Fri Jan 9 02:58:00 GMT 2004
Hi Bryce,
>Here's my BufferedReader and InputStreamReader improvements. Perhaps
>you would like to bake these versions off against your modifications.
>In the case of BufferedReader the new code is a lot simpler as well as
>potentially more efficient, since it gets rid of all the special-case
>checks for "\r" at the end of each line.
I love this sort of variations-on-a-theme kind of coding! I'm anxious to try it out.
Just skimming your files, I saw one bug in InputStreamReader.read(char[],int,int):
---------------------------------------------8<--------------------------------------------------------
public int read (char[] buf, int offset, int count) throws IOException
{
<< censored >>
int charsRead = 0;
int wchars = wcount - wpos;
if (wchars > 0)
{
// Flush chars from "work" buffer.
System.arraycopy(work, wpos, buf, offset, wchars);
offset += wchars;
charsRead += wchars;
}
<< censored >>
}
}---------------------------------------------8<--------------------------------------------------------
The System.arraycopy will try to overrun the passed-in buffer if wchars > count.
I'll take this for a spin this weekend.
-- Mohan
http://www.thisiscool.com/
http://www.animalsong.org/
More information about the Java
mailing list