AssetManager2: Improve Theme performance
This change brings Theme ApplyStyle down to 2x the original performance and Theme attribute retrieval to less than the original performance. Yay! Benchmarks ran on marlin-eng ---------------------------------------------------------------------- Benchmark Time CPU Iterations ---------------------------------------------------------------------- BM_ThemeApplyStyleFramework 8540 ns 8500 ns 82105 BM_ThemeApplyStyleFrameworkOld 5280 ns 5258 ns 148849 BM_ThemeGetAttribute 8 ns 8 ns 88388549 BM_ThemeGetAttributeOld 11 ns 11 ns 63394463 ApplyStyle still takes some time, and the weird thing is that if I switch the data structure of ThemeType to use an std::vector<ThemeEntry>, the performance becomes better than the original implementation! The issue is that std::vector<T> takes up 24 bytes, which would make Themes take up 8 more bytes per ThemeType, which is unacceptable. Still trying to isolate where the performance gain is coming from. Test: make libandroidfw_tests && $ANDROID_BUILD_TOP/out/host/<host>/nativetest64/libandroidfw_tests/libandroidfw_tests Test: make libandroidfw_benchmarks && adb sync system && adb sync data && adb shell /data/benchmarktest64/libandroidfw_benchmarks/libandroidfw_benchmarks Change-Id: I0e7a756afd44b6aac1521e69c2b907258c262d3e
Loading
Please register or sign in to comment