Skip to content

Commit 1924bd3

Browse files
authored
ui changes
1 parent 1a099c4 commit 1924bd3

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

_posts/2018-07-02-how-to-reduce-cold-startup-time-101.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,28 +14,28 @@ Android developers provides a comprehensive explanation of app startup time [her
1414

1515
#### How much is too much?
1616

17-
For cold start, anything above 5 seconds is considered excessive.
17+
For cold start, anything above **5 seconds** is considered excessive.
1818

1919

2020

2121
#### How do I track the cold start performance of my app?
2222

23-
To check how your Android app is performing in comparison to other apps, go to Play Console > your app > Android Vitals > App Startup Time.
23+
To check how your Android app is performing in comparison to other apps, go to **Play Console > your app > Android Vitals > App Startup Time.**
2424

2525

2626

2727
#### And how do I get the exact number?
2828

29-
In Android 4.4 and higher, logcat includes an output line containing a value called "Displayed". This value represents the amount of time elapsed between launching the process and finishing drawing the corresponding activity on the screen. The reported log line looks similar to the following example:
29+
In Android 4.4 and higher, logcat includes an output line containing a value called **"Displayed"**. This value represents the amount of time elapsed between launching the process and finishing drawing the corresponding activity on the screen. The reported log line looks similar to the following example:
3030

31-
ActivityManager: Displayed com.android.app/.StartupTiming: +3s534ms
31+
**ActivityManager: Displayed com.android.app/.StartupTiming: +3s534ms**
3232

3333
P.S. if you are tracking the time in Android studio, make sure you disable filters in your logcat view because it is the system server, and not the app, that serves this log.
3434

3535

3636
Don't be confused if the "Displayed" line in the logcat output contains an additional field for "total" time. For example:
3737

38-
ActivityManager: Displayed com.android.gradeup/.StartupTiming: +3s534ms (total +1m22s643ms)
38+
**ActivityManager: Displayed com.android.gradeup/.StartupTiming: +3s534ms (total +1m22s643ms)**
3939

4040
Here, the first time measurement is only for the activity that was first drawn and the "total" time measurement begins at the app process start, and could include another activity that was started first but did not display anything to the screen (for example a splash screen). This extra measurement is shown when there is a difference between the single activity and total startup times.
4141

@@ -53,7 +53,7 @@ Before we delve into the code and start digging it for prospective flaws, let's
5353

5454
* **Hierarchy Viewer**: Hierarchy Viewer  allows you to measure the layout speed for each view in your layout hierarchy. It can help you find performance bottlenecks caused by the structure of your view hierarchy.
5555

56-
P.S. If you're using Android Studio 3.1 or later, you should instead use Layout Inspector to inspect your app's view hierarchy at runtime. 
56+
P.S. If you're using Android Studio 3.1 or later, you should instead use **Layout Inspector** to inspect your app's view hierarchy at runtime. 
5757

5858
* **Debug GPU Overdraw tool**: It uses color-coding to show the number of times your app draws each pixel on the screen. The higher this count, the more likely it is that overdraw affects your app's performance.
5959

@@ -77,7 +77,7 @@ Now that you have analysed your app and zeroed in the problematic areas, let's s
7777

7878
* **Use Dagger2 for dependency injection**: Dagger is a fully static, compile-time dependency injection framework for both Java and Android. It implements the dependency injection design pattern without the burden of writing the boilerplate and aims to address many of the development and performance issues that have plagued reflection-based solutions.
7979

80-
You can refer to [this](https://medium.com/@harivigneshjayapalan/dagger-2-for-android-beginners-dagger-2-part-i-f2de5564ab25) article for a detailed explanation of Dagger 2 and its usage
80+
You can refer to [this](https://medium.com/@harivigneshjayapalan/dagger-2-for-android-beginners-dagger-2-part-i-f2de5564ab25) article for a detailed explanation of Dagger 2 and its usage.
8181

8282

8383
* **Using Handler with delay**: Now this one might sound like a hack but it does wonders to your app startup performance- in cases where there is some piece of lethargic code which you cannot afford to shift from the main thread, you can put in in a Handler and use the postDelayed method, adding an appropriate delay(100 to 200ms should do just fine). This takes the weight off the onCreate and your app launches much quicker than before ,with unnoticeable delay in the execution of the delayed method.

0 commit comments

Comments
 (0)