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>, gnustuff at thisiscool dot com
- Cc: Christopher Marshall <christopherlmarshall at yahoo dot com>, tromey at redhat dot com, per at bothner dot net, java at gcc dot gnu dot org
- Date: Fri, 26 Dec 2003 17:15:18 -0600
- Subject: Re: gcj's IO performance vs blackdown JDK
- Reply-to: gnustuff at thisiscool dot com
12/26/2003 11:59:37 AM, Mohan Embar <gnustuff@thisiscool.com> wrote:
>Here are my timings for successive iterations of this. And attached is
>my informal patch for the (direct read into buffer + StringBuffer member
>variable + String.valueOf() + lineEnd() native) fix.
>direct read into buffer
>+ StringBuffer member variable
>+ String.valueOf()
>+ lineEnd() native
>-------------------
>running gcj version
>100000
>
>real 0m17.185s
>user 0m15.412s
>sys 0m1.330s
>running jdk version
>100000
>
>real 0m17.001s
>user 0m15.615s
>sys 0m1.027s
>+jint java::io::BufferedReader::lineEnd (jint limit)
>+{
>+ jchar *pbuf = elements (buffer) + pos;
>+ int i = pos;
>+ for (; i < limit; i++)
>+ {
>+ jchar ch = *pbuf++;
>+ if (ch == '\n' || ch == '\r')
>+ break;
>+ }
>+ return i;
>+}
By changing the above native code to this:
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;
}
...I get a savings of almost another 1s:
running gcj version
100000
real 0m16.321s
user 0m14.518s
sys 0m1.334s
running jdk version
100000
real 0m17.039s
user 0m15.572s
sys 0m1.098s
If anyone cares to enlighten me about what compiler optimization phenomena
explains this, I'd be interested.
-- Mohan
http://www.thisiscool.com/
http://www.animalsong.org/