gcj's IO performance vs blackdown JDK

Mohan Embar gnustuff@thisiscool.com
Sat Dec 27 20:10:00 GMT 2003


Hi Andrew,

>Try this instead it should give you even more.

Here is the output from three successive runs of the "old" version
vs. yours, with the JDK output included each time for reference.
I think the timings are essentially the same, but your version could
be slightly faster....

-- Mohan
http://www.thisiscool.com/
http://www.animalsong.org/

1. pos <= i < limit
-------------------------8<-------------------------
jint java::io::BufferedReader::lineEnd (jint limit)
{
  jchar *pbuf = elements (buffer);
  int i = pos;
  for (; i < limit; i++)
  {
    jchar ch = pbuf[i];
    if (ch == '\n' || ch == '\r')
      break;
  }
  return i;
}
-------------------------8<-------------------------

          GCJ (1)      JRE
        ---------   ---------
user    0m14.506s   0m15.549s
user    0m14.531s   0m15.584s
user    0m14.527s   0m15.566s


2. 0 <= i < limit - pos
-------------------------8<-------------------------
jint java::io::BufferedReader::lineEnd (jint limit)
{
  jchar *pbuf = elements (buffer) + pos;
  int i = 0;
  limit -= pos;
  for (; i < limit; i++)
  {
    jchar ch = pbuf[i];
    if (ch == '\n' || ch == '\r')
      break;
  }
  return i+pos;
}
-------------------------8<-------------------------

          GCJ (2)      JRE
        ---------   ---------
user    0m14.508s   0m15.645s
user    0m14.479s   0m15.637s
user    0m14.545s   0m15.574s





More information about the Java mailing list