AndreMiras / EtherollApp

Provably fair dice game running on the Ethereum blockchain
MIT License
57 stars 22 forks source link

Investigate how to improve app loading speed #91

Closed AndreMiras closed 6 years ago

AndreMiras commented 6 years ago

On Android the app takes quite a while to load. Even though we fixed https://github.com/AndreMiras/EtherollApp/issues/68 and https://github.com/AndreMiras/EtherollApp/issues/47

I think we could try to also lazy load some modules so not all get loaded at application start up. This task doesn't have a quantitative target since it's more about investigation if something is doable to improve things.

AndreMiras commented 6 years ago

For records it currently seems to start in 14 seconds on my device, when no applications are in ram. See first and last adb line log below:

session 1:
05-29 20:45:37.825  8693  8726 I python  : Initialize Python for Android
05-29 20:45:51.777  8693  8726 I python  : ERROR:kivy:[Base        ] Failed to import "android" module. Could not remove android presplash.
result: 14s

session 2:
05-29 20:48:35.209  9012  9045 I python  : Initialize Python for Android
05-29 20:48:49.016  9012  9045 I python  : ERROR:kivy:[Base        ] Failed to import "android" module. Could not remove android presplash.
result: 14s

session 3:
05-29 20:49:35.923  9459  9493 I python  : Initialize Python for Android
05-29 20:49:49.783  9459  9493 I python  : ERROR:kivy:[Base        ] Failed to import "android" module. Could not remove android presplash.
result: 14s
AndreMiras commented 6 years ago

Now starting in 7s with all the lazy loading:

05-30 18:28:31.155 27768 27802 I python  : Initialize Python for Android
05-30 18:28:38.389 27768 27802 I python  : ERROR:kivy:[Base        ] Failed to import "android" module. Could not remove android presplash.

However when loading the switch account screen the first time, some lazy loading start and it quite slow and laggy, https://github.com/AndreMiras/EtherollApp/issues/66 should also help but not only.

  1. importing modules & loading screen on user demand takes time, so maybe we should preload in a background process before user request
  2. the UI is not responsive during the loading so things should be done in a thread
  3. a loading cursor should be displayed to show user something is happening
AndreMiras commented 6 years ago

Since loading the AccountUtils in a thread on user request (at switch accounts screen loading) was taking vert long, I decided to preload it after application startup in 01ca0b0779ff283b6a3966e1580e489c29dbe5ed. So the application will start and show widgets in 7s, but will be unresponsive for some more seconds until the AccountUtils loading is over. For some reason I couldn't toggle UI off (like we do during when clicking roll button). Let's come back to it later if this is really an issue.