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: about non-compatible optimization (was: Re: patch to bringjava vtables closer to g++ abi conformance)


Bryce McKinlay <bryce@waitaki.otago.ac.nz> wrote:

> I am curious why you mentioned "dynamic invocations" or "method lookup"
> as being slow. It isn't. In fact a virtual method call (in a loop) in
> GCJ is *faster* than a static method call (in Java or C). Try it if you
> don't believe me!

It sounds curious.  But I could confirm it.

I measured the time taken to invoke a method 10,000,000
times for GCJ.  Java source files attached to this mail
are compiled with -O option and executed on a 600 MHz
Pentium III PC.

  invokevirtual:   234  (faster than invokestatic)
  invokespecial:    68
  invokeinterface: 554
  invokestatic:    319
    (msec)

The version of GCC is as follows:

  % gcj -v
  ...
  gcc version 3.1 20020115 (Red Hat Linux Rawhide 3.1-0.18)


  Kazuyuki Shudo	shudo@computer.org	http://www.shudo.net/

Attachment: InvocationBenchmark.java
Description: Text document

Attachment: InvocationBenchmarkDerived.java
Description: Text document

Attachment: InvocationBenchmarkIntf.java
Description: Text document


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