5 Performance Tricks You Can Implement Today

Tips for App Developers

test.ai
Appdiff
4 min readDec 1, 2016

--

Performance issues are tough to diagnose in mobile apps, but here a few ways to score a quick win and improve your apps.

These stock image models got some quick wins too.

Cache

Cache everything. Well, everything that’s reasonable. Don’t keep pulling your company’s logo down via URL every time the app is launched. Unless you are building a real-time stock quote app, you can probably cache almost all your URL calls. It is too easy to do this right with libraries like SDWebImage. Cache. Cache. Cache.

Async UX

The biggest performance issue that impacts users is a slow UX. A common cause is developers that perform computation or network calls synchronously, which makes the app slow or appear non-responsive to the user. Never run anything on the UX thread. If you are handling a button click, move the handler to an asynchronous message handler running on a different thread. If you want to do some state restoration or saving, don’t execute it on the main/launcher code path. Never. The latest versions of Android actually try to prevent you from doing this at build time.

Optimize your UX

Here is the basic AsyncTask pattern for Android development. On iOS it is up to you to know what you are doing. Use dispatchqueues and sendAsynchronousRequest networking calls. If you do anything on the UX thread, your users will notice.

Defer Network Calls

Often your app is slow because you are hitting the network. If your app includes other SDKs or social networking APIs, you may not even realize how network intensive your app has become.

A quick way to see what network calls your app is making, and how to slow they are, is to add the New Relic mobile SDK to your app. New Relic shows a very useful, and simple breakdown of everything slowing your app down.

Often apps try to pull a lot of state down from the server during the app’s launch. Instead, defer every network call as long as you can. Run things in the background if you can. Don’t slow down launch or user interactions with non-essential network activity.

Server Profiling

If you profile your server, you can also track down what is causing the slowest of your network calls and fix the server latency in the interest of the app’s performance. Server latency that used to be OK for desktop and web, will be likely be very poor on a mobile app on a poor network connection. Many top app teams also create dedicated APIs for their mobile app, even if they already have APIs defined for their web site. They often combine 3 or more chained calls into a single response as fewer network calls are generally nicer on the battery and speed up the app.

Performance is half perception and half reality. You will be surprised how much networking your app does, and how much it slows your app down.

In its early days, Instagram would upload photos in advance to make the app seem super snappy.

Source: Mike Krieger, Warm Gun 2011

Misdirection

If your app is noticeably slow, and you can’t get around it yet, some slight of hand can also help.

When performance gets tough, the best app designers start distracting users. If you are waiting for 100 images to load you can avoid dreaded spinners, you can just show the images in sets of 5, and have some fun UX slide in as the next set of 5 finish downloading. Distracting the user with shiny things can go a long way to improving your app’s perceived performance.

Kevin Leneway, co-founder and CTO of Haiku Deck gave a great presentation on misdirection and other tips to keep your users happy and in love with your app.

Standards

Set performance goals for your app. Make performance goals part of your app’s core requirements, on par with the app’s features. Measures often, and ideally measure every build in an agile environment, to catch performance regressions at the time they happen. Performance on mobile often requires UX and code design decisions — consider it up front.

Stay up to date with the latest stories about mobile performance and testing by subscribing to the Appdiff newsletter.

--

--