diff options
| author | 2022-09-03 11:01:19 +0800 | |
|---|---|---|
| committer | 2022-09-22 12:44:13 +0800 | |
| commit | 3b589c8f90775729896c40072cadd53488c598b5 (patch) | |
| tree | 64eebac56873d509fd7d3752ed99c420966773b4 /libs/androidfw/StringPool.cpp | |
| parent | a07f4f5532d8386c1824ec0029f422dae3cf4015 (diff) | |
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
Diffstat (limited to 'libs/androidfw/StringPool.cpp')
0 files changed, 0 insertions, 0 deletions