This is the mail archive of the java@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: gcj's IO performance vs blackdown JDK


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/




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