[patch] JNI performance improvements
graydon hoare
graydon@redhat.com
Thu Jan 13 05:33:00 GMT 2005
hi,
this patch implements two JNI optimizations:
- avoidance of the malloc/free on each JNI call, when the call only
uses the "bottom", non-reentrant frame (this is the majority of JNI
traffic).
- a fast path which avoids clearing the frame when leaving it, if
no local references have been made. most JNI functions do not make
any local references.
remarkably, these two optimizations speed up JNI by about 15x (5x for
the first optimization, 3x for the second). our JNI is now slightly
faster than sun's: on my machine we spend 95ns/call vs. sun's 129ns,
accodring to bryce's benchmark (see bug 12957).
the patch is against java-gui-branch, which is where I've committed it,
but it'd probably be good to copy over to trunk before 4.0 finishes up.
-graydon
2005-01-13 Graydon Hoare <graydon@redhat.com>
* include/jni.h (_Jv_JNIEnv::bottom_locals): New field.
* include/jvm.h (_Jv_FreeJNIEnv): Declare.
* java/lang/natThread.cc (finalize_native): Call _Jv_FreeJNIEnv.
* jni.cc: Reuse bottom frame between calls, avoid clearing
frame when no local references are made.
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: jni-frame-optimization.patch
URL: <http://gcc.gnu.org/pipermail/java-patches/attachments/20050113/d0aa4cf5/attachment.ksh>
More information about the Java-patches
mailing list