optimized JNI