This is the mail archive of the
java@gcc.gnu.org
mailing list for the Java project.
Re: gcj's IO performance vs blackdown JDK
- From: Mohan Embar <gnustuff at thisiscool dot com>
- To: Bryce McKinlay <bryce at mckinlay dot net dot nz>
- Cc: GCC-Java Java <java at gcc dot gnu dot org>
- Date: Thu, 08 Jan 2004 20:58:40 -0600
- Subject: Re: gcj's IO performance vs blackdown JDK
- Reply-to: gnustuff at thisiscool dot com
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/