JNI without Jni_Lookup() ?

Bryce McKinlay mckinlay@redhat.com
Mon Apr 19 21:48:00 GMT 2004


Tom Tromey wrote:

>>>>>>"Erik" == Erik Poupaert <erik.poupaert@skynet.be> writes:
>>>>>>            
>>>>>>
>
>Erik> At present JNI has a performance disadvantage compared to CNI,
>Erik> because JNI methods need to get looked up in hashtables, while
>Erik> CNI can be linked statically.
>
>This cost is pretty small, actually.  We cache the results of the JNI
>lookup, so that is only done once.
>
>We do have an expensive way of making JNI stack frames.  It would be
>worthwhile to profile this code and seeing if improving it would make
>sense.
>  
>

Fixing the stack frame stuff would significantly improve JNI 
performance, IMO. At the moment, I suspect the cost of the method lookup 
is insignificant compared to the overhead of the frame creation.

By my (casual) measurements, our JNI is on the order of 10X slower than 
the JRE for Java->C calls. There's a test case in bugzilla:

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12957

But you're right, maybe we should oprofile it to be sure.

Regards

Bryce.



More information about the Java mailing list