Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Skip to content
Commit 3b589c8f authored by felkachang's avatar felkachang
Browse files

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
parent a07f4f55
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment