gcj's IO performance vs blackdown JDK

Andrew Pinski pinskia@physics.uc.edu
Sat Dec 27 03:33:00 GMT 2003


On Dec 26, 2003, at 18:15, Mohan Embar wrote:
>> +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;
> }

Try this instead it should give you even more.
Basically gcc holds tries to find loop variants and tries to combine 
them together
or split them apart which is what is happening in the second and third 
code.
My example should be faster but it might be slower, I have not looked 
into it that
much.
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;
}
Thanks,
Andrew Pinski


More information about the Java mailing list

AltStyle によって変換されたページ (->オリジナル) /