16
Mobile WebKit Optimizations & Tools Andrew Hedges Lead Engineer, Tapulous @segdeha 1

Mobile WebKit Optimizations & Tools

Embed Size (px)

DESCRIPTION

Slides from my August 10, 2011, presentation to the Mt View JavaScript Meetup.

Citation preview

Page 1: Mobile WebKit Optimizations & Tools

Mobile WebKitOptimizations & Tools

Andrew HedgesLead Engineer, Tapulous

@segdeha

1

Page 2: Mobile WebKit Optimizations & Tools

2

Page 3: Mobile WebKit Optimizations & Tools

3

Page 4: Mobile WebKit Optimizations & Tools

4

Page 5: Mobile WebKit Optimizations & Tools

5

Page 6: Mobile WebKit Optimizations & Tools

6

Page 7: Mobile WebKit Optimizations & Tools

7

Page 8: Mobile WebKit Optimizations & Tools

Optimizing for mobile

8

Page 9: Mobile WebKit Optimizations & Tools

Reduce the number of requests

• concatenate and/or inline CSS & JS

• image sprites

• inline, base64 binary assets

9

Page 10: Mobile WebKit Optimizations & Tools

Send fewer bytes

• gzip text resources

• uglify/minify CSS & JS

• properly compress images

• use cookie-less hosts for static assets

• leave out unnecessary tags?

10

Page 11: Mobile WebKit Optimizations & Tools

Cache aggressively

• HTML5 cache manifest

• localStorage

• custom, in-app caching

• reference in-app resources?

11

Page 12: Mobile WebKit Optimizations & Tools

Leverage CSS3

• transforms, transitions, animations

• gradients (& other techniques) in place of images

• 9-slice borders using border-image

12

Page 13: Mobile WebKit Optimizations & Tools

Use JavaScript conservatively

• use touch events

• reduce the use of closures

• only execute the code you need

13

Page 14: Mobile WebKit Optimizations & Tools

Donʼt reinvent the wheel

• Zepto

• jQTouch

• iScroll

• underscore.js & backbone.js

14

Page 15: Mobile WebKit Optimizations & Tools

Tools of the trade

• Charles Proxy

• Weinre

15