Silverfish
Silverfish copied to clipboard
If a lot of apps are placed in the same tab then the tab will take to much time to load
Placing 300 apps in the same tab will make it load for almost 30 seconds before showing the contents of the tab.
Changing from an empty tab to a tab with 65 apps, loading icons:
08-08 16:54:23.484 — Adding... 08-08 16:54:23.712 — Done (228ms)
Changing from an empty tab to a tab with 65 apps, not loading icons:
08-08 16:54:45.057 — Adding... 08-08 16:54:45.066 — Done (9ms)
Results may vary, but the icons seem to be the culprit
Perhaps the icons should be loaded async? Or maybe we should cache all the app details (including icons) for all of the launcher lifetime? A scaled app icon can't really be that large, perhaps increases the RAM consumption 1MB overall with many apps
I am currently working on loading in all app icons and labels into RAM and keeping them there for the apps life time. We'll see if how it works out.
I think it would work better as a setting. I mean, some people with low specs devices may prefer waiting a little longer rather than keeping the icons in memory. Just a suggestion. Or perhaps instead querying the application manager, the launcher could have its own cache (I don't know if that would perform better, but it probably does)
I am not sure what the best approach is so we can play around, try different methods, maybe try to combine them? And see what the best way of doing this is.
I think loading them async for the first time is a good idea, so it doesn't slow down the entire process. Then it would be matter of trying to load an icon from a file (not querying the package manager) see if that's any faster. If it doesn't impact performance in a good way, probably our last choice is to keep them in the RAM.
Sounds reasonable. Let's try in that order
I created a branch where I have implemented async loading of app icons. The UI thread is not slowed down anymore, as expected, but since the icons are so slow at loading it does not look nice at all. Test it if you are interested.
I will test it...! As soon as I know enough git to switch to the branch. I've cloned the repository and checked out the branch and I can't see the changes so... Anyway that's out of this issue 😅
you can simply do
git checkout -b app-loading-improvement-async origin/app-loading-improvement-async
Haha thank you, got it! 😋 It clearly looks faster now. How do you feel it @stanipintjuk? Does it feel to run smoother or perhaps it's too bad until it loads?
In my opinion, it works better. I don't see any inconvenience.
It is ok on my samsung s4 mini using internal storage, but on my huawei using external storage it is a bit too slow. I can see the icons loading while scrolling down. It is annoying and can sometimes be confusing.
Hmm, maybe it's not an option then.
I will test with caching as well. In theory it should speed things up because from what I have read is that PackageManager has to extract the icon and label from the application's apk. And this is apparently very slow
Okay! Also, I don't know what will be faster. If a cached icon with compression or in a raw format. In the first case, it won't need to decode the image, but in the second one it will take more disk space and also slightly more time to read from disk.