8

This question is of concern to me (and perhaps many out there) because there is no spinning part in my phone.

My phone has a Quad Core, 3 Gig of RAM, and so much storage space, all SSD-like in nature, with amazing read/write speeds.

With all this, Android (Both KitKat and Lollipop) takes some 80 seconds to boot to completion. It takes way less on Ubuntu using systemd or upstart. (some users report less than 10 seconds booting time using Ubuntu with systemd and some 20 seconds when using Upstart, with specs like Intel i5 and RAM of 8 Gig)

So, what makes Android boot so slow? And is there anything as a user, I can do to speed up the booting process?

Edit: according to booting process explained (https://android.stackexchange.com/a/29738/27870 ), there doesn't seem to be much differences in the overall booting process compared to conventional OS like Ubuntu. Where does Android go wrong in the process.

  • 1) You wrote the specs but not the model name! 2) Are you using Multiple ROMs as well? 2) What's the point in comparing a desktop with a mobile that differs in OS and HW so much? 3) Which ROM and Android version are you currently using? 4) Have you tried removing apps from startup? 5) Have you compared the difference in boot time between a new ROM and ROM installed with all your apps? // I use Autostarts to remove apps from startup. – Firelord May 22 '15 at 14:26
  • Many folks use Xposed modules to do the job. I guess you need to Google for such. May be somebody else can mention them. – Firelord May 22 '15 at 14:30
  • @Firelord I'm using only one ROM. Both although running on desktop and phones, both depend on similar kernel if not similar (just compiled for different architectures.) I'm currently using 5.1.1. Have used since 4.0 and the boot speed never increase. Even with fresh installed boot speed compared with when my full apps are loaded, there isn't any significant time difference. Using the autostart, how fast does your phone boot? By the way, I'm on xperia z2 – KhoPhi May 22 '15 at 15:29
  • 1
    My concern has to deal more of out of the box Android. It's slow. Its true ARM isn't close to processors on PCs, but the speed most phones are equipped with these days, I expected boot times to improve, but it's not. ART was designed to make running apps faster. Who's working on one to make booting faster out of the box? – KhoPhi May 22 '15 at 15:47
  • 1
    Not convinced it is ARM because my much older ARM based Chromebook boots up immediately and i mean that pretty much literally. – rjt Jun 7 '16 at 16:00
10
+50

Few years back, I worked on Android boot time optimization, as a Android developer. Obviously, as part of this work, we first needed to analyse where Android spends time during booting.

Below is the brief findings:

Hardware used : OMAP3430 Board which is like development board on which Stock Android is flashed. On actual commercial/production device, there will be additional specific hardware. To visualize the boot time, we used a developer tool called bootchart

The most time spend by Android is in following 2 areas:

  1. Zygote process. When android OS is started it will start Zygote process, it preloads classes to create a shared memory area for applications. This work of proloading of java classes takes @23 secs for its completion.

Why? Because The zygote class preloading is essential for good performance of the system after boot. So once classes are loaded of all apps, then run-time of app is much faster.

  1. Package manager service. In logcat output, we can see that Package manager scans 4 directories. /system/app, /system/framework, /data/app, /data/app-private.

Next, there is a component called Activity Manager which start differents services such as Location service, Telephony service etc. And it takes nearly 11-12 sec to finish this.

Why? Because, The package scan can in theory do some caching of its results after first boot and may check for security vulnerabilities.

If you add up these 2 times, it is about 35 Seconds

You may ignore these numbers in Today's day and age, but the point these number indicate is where Android AOSP code spends time during boot. OEMs have their own set of hardware which varies device to device.

Of course, there are other hardware and software initializations that Android needs to do after these 2 time consuming steps, which can stretch boot time further.

And is there anything as a user, I can do to speed up the booting process?

Not much I guess. The Android developer community and OEMs are still working on expediting the boot time but as you may imagine, it is not all that easy and making changes to optimize boot time may end up causing more app load time during normal operations, as hinted by Android framework engineer.

  • Why is the zygote process image not cached as every good VM does (like smalltalk and lisp)? Why can't the Android GUI come up before the telephony API is ready. Why is all this sequential? WHY DO WE STILL USE JAVA. There is no reason why Android boot time should be slower then a C64 boot time which means 1 second – Lothar May 31 '18 at 14:49
4

Android boot is slow?

My phone has a Quad Core, 3 Gig of RAM ... Android (Both KitKat and Lollipop) takes some 80 seconds to boot to completion.

My phone is only dual core with 1G RAM (Zenfone 4) and I never have that problem. Cold boot in ~60 seconds, reboot in 40-ish (CyannogenMod 12.1).

some users report less than 10 seconds booting time using Ubuntu with systemd and some 20 seconds ...

It depends on the config and what you considered "boot time". My laptop (i5 1st Gen, 4 GB RAM with spinning disk) is considered usable (finished booting) after about 90 seconds. Sure I can delay/disable some of the services to get faster boot time and start them manually as needed. But in my point of view, based on my preference, that won't count as usable.

On PC vs Mobile

There's some differences you should consider when comparing between pc and mobile linux. from CPU down to the kernel. Most notable differences:

  • Due to the nature of the device, mobile CPU mostly designed with power conservation as main consideration. This greatly affect performance.
  • Android kernel have some mobile-specific features which may affect boot time and hardware i/o access.
  • Furthermore, Android kernel known to have compatibility problems with mainline/stable. This is mostly due to vendor's preference to stick with old kernel version that compatible with their device drivers. AOSP Marshmallow runs 3.18.10 while stable kernel is currently at 4.6.2.

So, what makes Android boot so slow?

Why don't we check? :)

If you have access to adb and already enable Developer Options, check the boot log using

adb logcat -d -b events -v threadtime | grep "boot"

on my device, this is the output:

bambang@pamungkas ~ % adb logcat -d -b events -v threadtime | grep "boot"
06-08 04:35:01.417   193   193 I boot_progress_start: 9906
06-08 04:35:03.718   193   193 I boot_progress_preload_start: 12208
06-08 04:35:07.838   193   193 I boot_progress_preload_end: 16328
06-08 04:35:08.158   513   513 I boot_progress_system_run: 16647
06-08 04:35:09.880   513   513 I boot_progress_pms_start: 18370
06-08 04:35:10.204   513   513 I boot_progress_pms_system_scan_start: 18693
06-08 04:35:24.487   513   513 I boot_progress_pms_data_scan_start: 32977
06-08 04:35:28.552   513   513 I boot_progress_pms_scan_end: 37042
06-08 04:35:28.696   513   513 I boot_progress_pms_ready: 37186
06-08 04:35:33.088   513   513 I boot_progress_ams_ready: 41578
06-08 04:35:40.755   513   533 I boot_progress_enable_screen: 49244

As you can see, total boot time from VM start until initial screen drawing by window manager is ~40 seconds. Additional time on firmware & kernel space (on your linked asnwer, this translate to step 1-4) isn't included.

Notice that it takes ~18 secs to process the entire system's apk (boot_progress_pms_*), this translate to ~45% of boot time, which includes:

  • cleaning inexistent system packages and incomplete installation of packages,
  • validating installed apps,
  • setting library path,
  • etc (see: complete source code of PackageManagerService)

So generally, the total boot time is dependent with the number of packages (app) installed on the device. More app means longer wait during pms process. Additionally, starting activities takes ~5 sec / 20% of boot time. The rest is neither significant nor safely modifiable without deep knowlegde of system behaviors.

Is there anything I can do to speed up the booting process?

  • Try other ROM. Sony is one of the "good guys" who provide healthy environment for tweakers. I recommend AOSP or Cyanogen. Just be aware of the limitations
  • Test, don't assume! It's easy to make assumption that A boot slow, B is faster. A simple logcat command like above would reveal some useful infos for basic boot time benchmarking between ROMs.
  • If you know what you're doing, Embedded Linux Wiki have a list of possible tweaks to improve boot time.

On improving boot time

On your comment

ART was designed to make running apps faster. Who's working on one to make booting faster out of the box?

In my opinion, tweaking boot time is both unnecesarry and provide insignificant gain. Since your phone will, theoretically, stay up most of the time; it's far more important to maintain the system stability (with the tradeoff of longer boot process) to ensure higher uptime and less error.

  • adb logcat -d -b events -v threadtime | grep "boot" returns empty. I checked on reboot, and still no logs in there matching boot. – KhoPhi Jun 13 '16 at 18:28
  • @Rexford: hmmm, mine is working just fine. You could try to pipe it to a pager (e.g: less) and search from there: adb logcat -d -b events -v threadtime | less. Or modify logcat ring buffer – bangbambang Jun 15 '16 at 19:03
0

For what it's worth, I run Android-x86 in a Virtual Machine under Linux and it boots in about 22 seconds, which is on par with most GNU/Linux distributions and Windows 10 on an SSD drive with a quad-core desktop CPU.

So I don't consider the Android boot time to be particularly slow.

  • Bear in mind that the question was submitted in 2015. – Andy Yan Jul 14 '17 at 8:05
  • @AndyYan I noticed, but Android-x86 is much older. – Marc.2377 Jul 14 '17 at 8:13
  • The hardware specs is there; software pressure matters a lot less under such powerful hardware (even after efficiency degradation in VMs). – Andy Yan Jul 14 '17 at 9:13
  • @AndyYan I agree... but my point is that, by some standards, there's nothing inherent to Android that defines it as slow. That is, in comparison with other fully-fledged operating systems, for similar hardware. I felt this was worth adding. – Marc.2377 Jul 14 '17 at 9:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.