syphon-org / syphon

⚗️ a privacy centric matrix client
https://syphon.org
GNU Affero General Public License v3.0
1.04k stars 72 forks source link

App loading is unbearably slow #428

Closed notramo closed 2 years ago

notramo commented 2 years ago

App loading is unbearably slow. Element Android takes 2-5 seconds to load (at most 10 sec. when launched first time without cache). On the other hand, Syphon always takes 25-30 (!) seconds (with or without cache) to get to the homescreen. Does this have to do something with encrypted db initialization?

0x1a8510f2 commented 2 years ago

Possible duplicate: https://github.com/syphon-org/syphon/issues/297

ereio commented 2 years ago

Storage should now be accessed under an isolate (thread)

This was supposed to be the nice part of our storage migration; you get background threads for storage 150 lines of code. This should help performance quite a bit. I'll do some profiling through Flutter as I knock out the other issues to confirm this was the issue

notramo commented 2 years ago

What will the UI do if loading the db in background takes 25-30 sec? How can it display rooms and conversations if the db is not ready yet?

ereio commented 2 years ago

It shouldn't take that long to load the DB in the background under any situation; I suspect something else is wrong here. I haven't encountered it taking this long but will profile for bottlenecks if this didn't fix it. Syphon once ran at near release speed in debug mode on my pixel 3a, going to test on that device and try to get that level of performance back.

notramo commented 2 years ago

I installed a CPU usage monitor app. The interesting thing is that the CPU is not used during the long loading. I measured it again a couple of times, and it always takes 30 sec to load (plus a few seconds because actual loading). Seems like a timeout thing.

At 20 sec into the loading, the top system UI bar changes color from semi-transparent to fully transparent (or Syphon's background color).

If I connect it to my Linux computer, loading time goes down to 10 sec, with the top bar changing color at 5-6 sec. Even if no connection is set up to the computer (just charging). ADB is disabled.

Disabling network connection on the phone doesn't change loading time either with connected USB or not.

ereio commented 2 years ago

Are you testing this under the build with the storage isolate or the latest stable version?

notramo commented 2 years ago

v0.2.3 release from Microsoft™ Github™