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


Mohan Embar writes:
 > 12/26/2003 11:59:37 AM, Mohan Embar <gnustuff@thisiscool.com> 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;
 > }
 > 
 > ...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.

Maybe register allocation.  Post the assembly output.

Andrew.


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