powerup-android
powerup-android copied to clipboard
Reducing the App startup time
App takes around 10 sec on a cold start and also take significant time to start on warm start. Since theme based approach has been not accepted by mentors earlier, I will like to use tools like inline tracing and method tracer to identify the bottlenecks causing this problem. Also i will identify other problems as mentioned in this link - https://developer.android.com/topic/performance/launch-time.html @chhavip @anubhakushwaha Can i work on this ?
@codingblazer Yeah you can go ahead and let us know your progress.
I followed https://developer.android.com/topic/performance/launch-time.html and these are my findings and solutions -
-
Ran the Inline Tracing and Systrace and stored the trace during the launch up time (White screen) Output - Html File (Open this file in browser) Solution - You can go to alerts tab in rightmost mid and see all things responsible for UI thread blocking (which causes delay for UI to show up). Clicking on any alert shows suggestions/solutions/video links to those problems. I propose to apply all those implementable solutions.
-
Ran the method tracing using CPU profiling during the launch up time and the trace recorded is shown below. As you can see, the Rendering and drawing is taking major time. Solution - Currently, in activity_main.xml we have two drawables which can replaced by single drawable and that drawable too can be optimised further. Also I will set this drawable as theme property so that this image is shown instead of white screen.

- Will use some other performance enhancing things like -
-
Replacing heavy initialisations in onCreate() by lazy initialisation of objects in StartActivity.
-
Reducing Global variables
-
Reducing amount of work in onCreate() or using another thread so as to avoid blocking of UI thread.
@chhavip @anubhakushwaha @aanchal07 Should I send PR for these proposed solutions.
These are good suggestions, but not possible to implement right now. They can and will be kept in mind during the next development cycle.
@codingblazer Would you like to work on this now?
@aanchal07 I was thinking of taking this at end of this development cycle. There will be major changes this cycle and this performance issue will again come up at the end. What do you think?
@codingblazer Alright then we can put this on hold for now.