This is the mail archive of the java-discuss@sourceware.cygnus.com 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]

Re: Interface method calls are slow.


Jeff Sturm wrote:

> Make sure your libgcj is newer than 11/04 or so... there was a nasty bug
> in the method cache:

Yeah, my libgcj is current.

> The DECL_INLINE patches are now in, but they don't seem to help without
> also patching gcc/calls.c:
>
> http://sourceware.cygnus.com/ml/java-discuss/1999-q4/msg00147.html

Thanks. With the calls.c patch, and by placing my private method before it is
called, It seems to have been inlined successfully. Of course, my java coding
style is usually to put private methods following where they are called, so I
guess its not going to help much...

[bryce@hokkaido invbench]$ gcj -O3 *.java *.cc -o bench --main=Bench -Winline
Bench.java: In class `Bench':
Bench.java: In method `Bench()':
Bench.java:10289284: warning: can't inline call to
`pad(java.lang.String,int,int)'
Bench.java:24: warning: called from here
Bench.java: In method `start()':
java/lang/System.java:0: warning: can't inline call to `currentTimeMillis()'
Bench.java:118: warning: called from here
Bench.java: In method `pad(java.lang.String,int,int)':
java/lang/Math.java:0: warning: can't inline call to `min(int,int)'
Bench.java:145: warning: called from here

[bryce@hokkaido invbench]$ ./bench
no call:           44ms [4ns / call]
local:            358ms [35ns / call]
private:           45ms [4ns / call]  <-- yay!
interface:       2973ms [297ns / call]
i/f after cast:   335ms [33ns / call]
abstract:         332ms [33ns / call]
abstract w/cast:  335ms [33ns / call]
native:           332ms [33ns / call]

regards

  [ bryce ]



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