nowinandroid
nowinandroid copied to clipboard
Allow InterestsItem to be skipped on recomposition
Fixes #73
Also adds a benchmark for topics state change to ensure this optimisation actually achieved better performance. P90+ were all improved even with a slight hit to P50 which may just be noise. This deemed this simple change worth it.
Before Change
frameDurationCpuMs P50 4.5, P90 14.0, P95 17.0, P99 25.1
frameOverrunMs P50 -11.4, P90 1.9, P95 2.9, P99 11.2
After Change
frameDurationCpuMs P50 5.0, P90 12.2, P95 15.1, P99 18.1
frameOverrunMs P50 -11.4, P90 -0.1, P95 1.1, P99 3.6
Failed experiments
Deferring the read of topics list:
I also tested what would happen by deferring the read of the topics list and making it an immutable list. This would allow more to be skipped higher up the chain, specifically InterestsContent. It lead to no gain, especially when compared with the increase in code complexity this did not seem worth it.
frameDurationCpuMs P50 4.9, P90 12.3, P95 15.9, P99 18.9
frameOverrunMs P50 -11.1, P90 -1.4, P95 0.3, P99 6.9
Bottom Bar: On state change we can also see the bottom bar recomposing, this might look like an issue but fixing it via an immutable list for the top level destinations and pre-calculating the selected top destination to get the bottom bar to skip actually made a negligible difference to performance whilst greatly increasing code complexity. I deemed this change not worth it.
frameDurationCpuMs P50 5.0, P90 12.6, P95 15.1, P99 19.0
frameOverrunMs P50 -11.4, P90 -1.8, P95 0.7, P99 4.5