This website uses cookies. By using the website you agree with our use of cookies. Know more

Technology

Mobile App Launch Performance I

By Gonçalo Alvarez
Gonçalo Alvarez
At Farfetch for 5 years. Has built his career in mobile development with sheer curiosity for the most complex tech matters. Carhartt enthusiast.
View All Posts
Mobile App Launch Performance I
"Like all great art, it defies the tyrant Time.” 
- Edwin A. Abbott, Flatland: A Romance of Many Dimensions

The technology landscape advances in quantum leaps. As it does, so do consumer habits. As of 2020, nearly 4.6 billion people are active Internet users - nearly 60% of the world population.

Mobile is king - BroadbandSearch claims mobile surpasses desktop usage in nearly every metric measured. By late 2019, combined web traffic witnessed 53% of accesses coming from mobile devices alone (and as high as 98% in China and 80% in India). According to Statista, media consumption on mobile devices rose to 203 minutes a day after a 130% increase over 5 years, surpassing desktop consumption by 37%.

At Farfetch, Native Mobile has taken a central role in customer experience. Over the course of the past five years, this channel has witnessed a growing performance in conversion rate leveraging long drawn usage, high engagement and increased retention.

As the tech landscape unfolds on top of a powerful infrastructure, so do app customers' expectations in regards to speed and ease of use. Customer tolerance for delays in responsiveness drops sharply just as our apps, platforms and products get faster and better. 

We have to remain on the tips of our toes to retain our users. We cannot afford to treat app launch performance as an afterthought.

This is the third of a series of articles dedicated to Mobile App Performance. In our next couple of articles, we will share the importance of App Launch performance at Farfetch and how we have come to mould it into engineering business cases, factoring them into business decisions.

This article covers the importance of performant App Launches, a glance through iOS app launch processes and how to make it all delightful!

Mobile App Launch Matters

"The first impression is the truth, and all that follows is merely the excuse of memory.”     
Andrew Crumey

First impressions

Nobel laureate Daniel Kahneman states, "It is the beginning, the first impression that sets the rhythm of the story.” This holds true no matter what narrative we are writing, reading or living. He adds: "… it is this preoccupation of first impressions that brand men, brand women and marketers should always remember. Make a good impression already at the door.”

App users portray increasingly elastic behaviours towards poor app launch performance. Customer expectations have surged over the past decade, following tech evolution in speed, resilience and ease of usage. We crave content, we want it now. We demand quality content to be delivered fast. And the faster it becomes, the faster and more uninterrupted we expect it to be. Expectations continuously outgrow reality.

The first experience with your app should be delightful!

AppDynamics reports that 86% of users have uninstalled apps after only using them once due to poor performance. A test by JWPlayer suggests that 70% of your audience will abandon an app flow within 11 seconds of waiting for content (in this case, a video within an app) to load. It is clear that slow apps make users unhappy. User discontent often goes way beyond app deletion: a poor user experience leads users to leave negative reviews and discourages consumers from downloading other apps from a given developer. In fact, 84% of users find app store ratings important when considering whether or not to download an app.

There is no second chance for making a first impression, and bad word-of-mouth spreads like wildfire. The backlash brought by slow app launch -- and its resulting decrease in adoption, retention, and increased negative chatter -- can impact a business beyond repair. All the effort put into product development can be rendered useless by poor app performance. Measuring is key.

iOS App Launch Components

The ideal launch time for an iOS app is two seconds. However, Apple’s guideline as of WWDC 2019 states your first pixels should be displayed within 400ms. This should allow your app to complete the launch animation, be interactive and responsive.

There are three types of app launches:

Cold - Cold launch happens after download or reboot, whenever the app is not in memory and no prior process of the app is running.

Warm - Warm launch is engaged whenever the app has been terminated recently and is still held in memory, either partially or in its integrity. No prior process of the app is running.

Resume - Resume is activated whenever the app has been suspended (e.g., left the foreground or became inactive). The app is fully in memory and its processes are running.

Make cold and warm launches as fast and delightful as a resume.

Throughout the initial 400ms of launch, there is an array of processes responsible for bringing your app to life. They are responsible for loading, opening and rendering your app.
  • System Interface (DYLD3):  In the first stage, the Dynamic Linker loads shared libraries and frameworks. This part of the process is optimised in warm launches, as it introduces caching of runtime dependencies to improve load time. This stage also initialises the interfaces with low level system components. This work has a fixed cost.
    • Best practices: Avoid linking unused frameworks. Avoid dynamic library loading during launch. Hard link all your dependencies.
  • Static Runtime Initialisation: This process initialises the language runtime and invokes all class static load methods.
    • Best practices: Expose dedicated initialisation API in frameworks. Reduce impact to launch by avoiding +[Class load] (watch out for method swizzling!). Use +[Class initialise] to lazily conduct static initialisation.
  • UIKit Initialisation: Instantiates UIApplication and UIApplicationDelegate. At this point the app begins event processing and integration with the system
    • Best practices: Minimise work in UIApplication subclass and minimise work in UIApplicationDelegate initialisation.
  • Application initialisation: At this point, the lifecycle callbacks are invoked - application:willFinishLaunchingWithOptions: and application:didFinishLaunchingWithOptions:. Also invoked are the UIApplicationDelegate UI lifecycle callbacks: applicationDidBecomeActive:.
    • Best practices: Defer unrelated work.
  • First frame render: Creates and performs the layout, drawing the view (i.e. loadView, viewDidLoad and layoutSubviews). This process commits and renders the first view.
    • Best practices: Flatten your view hierarchies and lazy load the views. Optimise your auto layout usage.
  • Extended: This stage comprises all the app-specific work after the first frame. This stage should take 200 ms and happens after the ideal 400ms system launch period is over. You should use this time to display asynchronously loaded data. At this point, the app should be interactive and responsive.

Improving Your App Launch Performance

There is an array of issues that may cause your app to launch slowly:
  1. Your app is obsolete and not supportive: By not releasing continuous updates of your app, you might miss the chance of using the latest updates in the software development kit and technology.
  2. Sluggishness of the server speed: An overloaded, overworking or even improperly architected server thwarts your app performance. The issue may even be related to the latency of a single process that your app heavily relies upon for most of its tasks. Identifying the interactions between the various components of the application (ADM; offloading the server side: using request compression, SSL termination, caching) and a load balancer can help.
  3. Encrypted connections are not optimised: Incorporate mechanisms such as HTTP/2 and SPDY to reduce the connection overhead with clients by requiring only a single handshake for each session.
  4. Chatty conversations: Your app makes several requests to conduct a transaction on behalf of individual operations within the application.
  5. Faulty library and software development kit: Ensure you’re using secure, stable, and reliable libraries that have a large community of developer users and/or support.
  6. App launch is overcrowded with data: Consume data responsibly to avoid cramming your app with data unnecessary for early stage flow - leverage lazy data consumption. Still, do it in a way you don’t curtail your data and compromise the handy features of your app.
  7. Network latency - Delays in network connections will slow down the loading of key components and resources fetched from the network
Apple suggests adopting three guidelines in order to improve your App Launch Performance:

1. Minimise your work
    • Defer work unrelated to first frame. If you don’t need it, don’t do it.
    • Move blocking work off the main thread.
    • Reduce memory usage.
2. Prioritise work
    • Identify the right QoS for your task.
    • Utilise scheduler optimisations for your app launch.
    • Preserve the priority with the right primitives.
3. Optimise work
    • Simplify or limit existing work.
    • Optimise algorithms and data structures.
    • Cache resources and computations.
Next time around, we will share strategy on Mobile App Launch Performance at Farfetch. 
How much does a millisecond in app launch cost? Stay tuned for answers.

Related Articles