10% improvement by changing FastNative to CriticalNative
This patch change native APIs from @FastNative to @CriticalNative. From the benchmark, it gets 10% improvement. The CriticalNative requires the native function can't access JNIEnv and any jobject. nativeGetAttributeIndex can't apply CriticalNative because it needs JNIEnv to transform Java String. This patches move the 16 APIs from FastNative to CriticalNative. * 11 APIs check the null document and throw NPE in native layer. They are change to return ERROR_NULL_DOCUMENT and throw NPE in java layer. * 5 APIs just remove JNIEnv and jobject parameters. * nativeGetNamespace * nativeGetName * nativeGetText * nativeGetStyleAttribute * nativeGetSourceResId Reference: ag/19992907 Bug: 173709508 Test: # for FastNative atest --iterations 20 \ CorePerfTests:android.content.res.XmlBlockBenchmark \ 2>&1 > fn20.txt Test: # for CriticalNative atest --iterations 20 \ CorePerfTests:android.content.res.XmlBlockBenchmark \ 2>&1 > cn20.txt Test: http://b/issues/173709508#comment2 Change-Id: I43ccd1177fa86df5cd4d432119cbd06d370e82d8
Loading
Please register or sign in to comment