Skip to content
Commit 30080e2f authored by Adam Lesinski's avatar Adam Lesinski
Browse files

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
parent 8a0f0ed4
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