Performance Tips

Although we all love carrying the Internet in our pockets, getting it in such a small container has come with a number of compromises. Namely, mobile devices are considerably underpowered when compared with desktop alternatives. Therefore, when developing for mobile, performance should always be one of your main concerns.

Mobile bandwidth

One of the major challenges in mobile development is optimizing for mobile bandwidth. High-speed Internet allows web apps to fly for desktop browsers, but mobile apps tend to crawl at the speed of dial-up. Sure, advances in mobile networks have brought faster connections, but these improvements are met with increased expectations on what mobile apps should deliver. Furthermore, these networks can be spotty—you shouldn’t assume users always have 4G.

One of the best ways to improve the performance of your mobile app is to reduce its bandwidth needs.

Fewer images, more CSS

Assuming you don’t need any video or audio, the largest bandwidth consumer in your app is most likely imagery. Fortunately, modern mobile browsers offer a variety of CSS3 properties that can be used to avoid images wherever possible.

For instance, instead of using a separate image for each button in the Corks app, you used rounded corners, gradients, and borders generated purely with CSS. Although the CSS for these properties can be pretty long with vendor-specific prefixes, it is nothing compared to what it would cost in actual images. Furthermore, CSS is much ...

Get Smashing Mobile Web Development now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.