Sparse native theme representation
Themes are represented in the native layer using an array where the entry id of resource ids are used to index into the array. This causes native allocation size of a theme to correlate with the largest attribute resource id in the styles applied to the theme. From manual testing, I determined that on average in 1P apps and system_server only 10-20% of the space allocated for themes actually hold theme attribute values and the rest is empty/unused space. Using std::vector and std::lower_bound to create a sparse array representation will reduce amount of memory allocated by themes while having a minimal impact on the performance of querying the attributes defined in a theme. From testing with ResourcesPerfWorkloads, this increased time spent in the resources synthetic benchmarks by ~1%. Bug: 141198925 Test: atest libandroidfw_tests Test: atest ResourcesPerfWorkloads Change-Id: Iec512b31b0545b0898ff248cd23f074a20fff45d
Loading
Please register or sign in to comment