Skip to content

Optimize UI performance

Andrew Churyla requested to merge rt1shnik/vlc-android:optimize_ui into master

I try to find more efficient modifications with minimal code changes, but in any case there are a lot of changes. We need thoroughly test the app to ensure that everything works fine before merging.

In first commit I use LinearLayout for constraintLayout2. More simple containers often works faster. This turned out to be true for our case as well. Perhaps there is a small change inside this commit that makes a decisive contribution to the performance gain as was with !1374 (merged), but I didn't find it for now. This modification improve UI speed (#2528 (closed)) and almost solves problem with release build on Samsung Note 4 (#2315 (comment 321559)).

UI appearing time (landscape orientation, video paused, animation disabled):

  • Samsung Note 4, Android 6.0.1 (debug): ~35 ms.
  • Samsung Note 4, Android 6.0.1 (release): ~95 ms.
  • Lenovo P2a42. Android 6.0.1 (release): ~45 ms.
  • Xiaomi 11T, Android 12 (release): ~40 ms.
  • Sony C6603, Android 5.1.1 (release): 30-120 ms.

Screenshot from profiler and trace-file after first commit:Note_4_after_commit_1_cpu-art-20220518T182219.trace Screenshot_from_2022-05-18_18-18-52

Next I want to do is removing RelativeLayout. Using RelativeLayout leads to double measuring all child views. If you use RelativeLayout inside RelativeLayout, children of inner layout will be measured 4 times. Next 2 commit replace RelativeLayout with FrameLayout. After this modification UI appearing time on Samsung Note 4 (release) is ~58 ms. You can notice on screenshot from profiler that measure section is much less than it was before.

Screenshot from profiler and trace-file after removing RelativeLayout: Note_4_after_commit_3_cpu-art-20220518T191844.trace Screenshot_from_2022-05-18_19-30-28

Edited by Andrew Churyla

Merge request reports

Loading