immich-app / immich

High performance self-hosted photo and video management solution.
https://immich.app
GNU Affero General Public License v3.0
52.38k stars 2.78k forks source link

refactor(mobile): backup info box #14171

Closed mertalev closed 6 days ago

mertalev commented 6 days ago

Description

The info box widget is very monolithic. As a result, the whole thing is constantly re-rendered for each progress update. This PR breaks the widget up into smaller widgets that only re-render when data that's relevant to them changes. It also removes the hidden thumbnail feature as it increases CPU usage and heat, and I don't think it's used much.

The providers are kind of weird and would probably benefit from a refactor as well, but I leave this for future work.

How Has This Been Tested?

Tested that backup progress and info looks normal when initiating a backup.

alextran1502 commented 6 days ago

Nice work! I saw many @pragma('vm:prefer-inline') is being used. Is there anything we should be mindful of when using the annotation? How can we tell if it improves the app's performance?

mertalev commented 6 days ago

The isar dev uses this a lot for short functions or functions that are only called once, and has run microbenchmarks showing improvements. There's no downside to using it when the function is only called once or if it's a short function. But it should be avoided for longer functions that are used in many places since it increases code size. It's basically a way to get the readability of a separate function with zero overhead.