Silverfish icon indicating copy to clipboard operation
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

Open stanipintjuk opened this issue 8 years ago • 15 comments

Placing 300 apps in the same tab will make it load for almost 30 seconds before showing the contents of the tab.

stanipintjuk avatar Aug 08 '16 12:08 stanipintjuk

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

Lonami avatar Aug 08 '16 14:08 Lonami

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

Lonami avatar Aug 08 '16 15:08 Lonami

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.

stanipintjuk avatar Aug 08 '16 15:08 stanipintjuk

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)

Lonami avatar Aug 08 '16 15:08 Lonami

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.

stanipintjuk avatar Aug 08 '16 16:08 stanipintjuk

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.

Lonami avatar Aug 08 '16 19:08 Lonami

Sounds reasonable. Let's try in that order

stanipintjuk avatar Aug 08 '16 21:08 stanipintjuk

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.

stanipintjuk avatar Aug 10 '16 11:08 stanipintjuk

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 😅

Lonami avatar Aug 10 '16 11:08 Lonami

you can simply do

git checkout -b app-loading-improvement-async origin/app-loading-improvement-async

stanipintjuk avatar Aug 10 '16 11:08 stanipintjuk

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.

Lonami avatar Aug 10 '16 13:08 Lonami

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.

stanipintjuk avatar Aug 10 '16 14:08 stanipintjuk

Hmm, maybe it's not an option then.

Lonami avatar Aug 10 '16 14:08 Lonami

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

stanipintjuk avatar Aug 10 '16 14:08 stanipintjuk

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.

Lonami avatar Aug 10 '16 15:08 Lonami