39
Performance Optimization for the Mobile Web Tuesday, October 23, 2012 Boston, MA

Performance Optimization for Mobile Web | Fresh Tilled Soil

Embed Size (px)

DESCRIPTION

In this presentation Fresh Tilled Soil takes a discerning look at how the mobile web has been transformed to date, and where it will go from here. We'll talk about the latest tools for testing and debugging websites, newest HTML5/CSS3/JavaScript technologies, and the best strategies for mobile website performance & optimization. Finally, we’ll reveal some of the exciting, not yet released web API’s that will bring the mobile-web user experience to a whole new level!

Citation preview

Page 1: Performance Optimization for Mobile Web | Fresh Tilled Soil

Performance Optimization for the Mobile Web

Tuesday, October 23, 2012Boston, MA

Page 2: Performance Optimization for Mobile Web | Fresh Tilled Soil

Agenda

● Brief Overview of the Mobile Web

● Testing, Measuring and Debugging

● Mobile Web Performance Optimization Areas

● Future of the Mobile Web

Page 3: Performance Optimization for Mobile Web | Fresh Tilled Soil

Mobile Web is Still...

SLOW!

Page 4: Performance Optimization for Mobile Web | Fresh Tilled Soil

Mobile Web Users...

ARE FED UP!

Page 5: Performance Optimization for Mobile Web | Fresh Tilled Soil

Mobile RAGE is UP!!!Mobile Rage: How People React to Slow Load Times

Curse at their phone

Scream at their phones

Throw their phones

Behave less or more normally

23%

4%

11%62%

Page 6: Performance Optimization for Mobile Web | Fresh Tilled Soil

Why?

Page 7: Performance Optimization for Mobile Web | Fresh Tilled Soil

BECAUSE OF US!

Page 8: Performance Optimization for Mobile Web | Fresh Tilled Soil

We are doing it WRONG!

Mobile web is slow because...

Page 9: Performance Optimization for Mobile Web | Fresh Tilled Soil

It's Complicated...

Page 10: Performance Optimization for Mobile Web | Fresh Tilled Soil

Mobile web varies by:

Page 11: Performance Optimization for Mobile Web | Fresh Tilled Soil

Mobile web varies by:

Page 12: Performance Optimization for Mobile Web | Fresh Tilled Soil

Mobile web varies by:

Page 13: Performance Optimization for Mobile Web | Fresh Tilled Soil

Mobile web varies by:

Page 14: Performance Optimization for Mobile Web | Fresh Tilled Soil

:(

Page 15: Performance Optimization for Mobile Web | Fresh Tilled Soil

:)

Page 16: Performance Optimization for Mobile Web | Fresh Tilled Soil

;)

Page 17: Performance Optimization for Mobile Web | Fresh Tilled Soil

It's all about...

SPEED

Page 18: Performance Optimization for Mobile Web | Fresh Tilled Soil

Testing, Measuring & Debugging

Page 19: Performance Optimization for Mobile Web | Fresh Tilled Soil

Ways to Test, Measure & Debug:

REAL DEVICES

REMOTE LABS

REMOTE BROWSER TOOLS

EMULATORS

Page 20: Performance Optimization for Mobile Web | Fresh Tilled Soil

EMULATORS

■ Good for first testing

■ Many different types --over 150+ (most are free)

■ www.mobilexweb.com/emulators

■ Can use a resized desktop browser

■ Emulators are not reliable

Page 21: Performance Optimization for Mobile Web | Fresh Tilled Soil

REMOTE LABS

■ BrowserStack.com

■ DeviceAnywhere.com

■ PerfectoMobile.com

■ Remove test lab (samsung) - free

■ Remote device access (nokia) - free

Page 22: Performance Optimization for Mobile Web | Fresh Tilled Soil

REMOTE BROWSER TOOLS

■ Opera Mobile with DragonFly

■ Blackberry Browser for Playbook

■ Mobile Chrome Developer Tools (via usb)

■ Mobile FireFox Developer Tools (via usb)

■ Very few remote browser tools available

Page 23: Performance Optimization for Mobile Web | Fresh Tilled Soil

REAL DEVICES

■ Proxies on wifi: charles proxy, fiddler

■ Remote JavaScript tools: weinre, adobe shadow

■ Proxies on the device: mobitest

■ hybrids / pseudo-browsers: mobitest

■ JavaScript utility libs: jconsole, watchr

■ network sniffers: pcapperf

■ server-side sniffers

Page 24: Performance Optimization for Mobile Web | Fresh Tilled Soil

Areas of Optimization & Mobile Web's

Performance Happy Friend:

Page 25: Performance Optimization for Mobile Web | Fresh Tilled Soil

Load Mobile Pages Faster

● Place stylesheets at top & scripts at the bottom

● JavaScript blocks parallel downloading (increasing load time)

Page 26: Performance Optimization for Mobile Web | Fresh Tilled Soil

Load Mobile Pages Faster (cont'd)

● Use multiple domains to overcome parallel download limitations

Page 27: Performance Optimization for Mobile Web | Fresh Tilled Soil

Load Mobile Pages Faster (cont'd)

● Minify JavaScript & CSS

● Defer loading of non-essential JavaScript

● GZIP components

● Reduce http requests (10x's slower than desktop)

● Deliver the mobile site directly --avoid redirects

● Use Local Storage & Application Cache (HTML5)

Page 28: Performance Optimization for Mobile Web | Fresh Tilled Soil

USE: Mobile HTML5

● Use simple, semantic mark-up:

○ Complex DOM == WRONG

○ Use Doctype: <!DOCTYPE HTML>

○ Do not use insane attributes <script type?>

○ Nested elements slow down rendering, animation & event handling

○ Avoid devitis: use article, section, nav...etc...

○ Leverage HTML5/CSS3 rules & tags where possible

○ HTML5 & CSS3 degrade gracefully --don't worry about compatibility

● Make your site mobile friendly:

○ Use mobile meta tags & viewport

○ Use responsive design approach

Page 29: Performance Optimization for Mobile Web | Fresh Tilled Soil

USE New Markup & Semantics

<details> / <summary>

Information

If your browser supports this element, it should allow you to expand and collapse these details.

<details open="open"> <summary>Information</summary> <p>If your browser supports this element, it should allow you to expand and collapse these details.</p></details>

Page 30: Performance Optimization for Mobile Web | Fresh Tilled Soil

USE New Markup & Semantics

<mark>

Semantically highlight parts of your text:

Lorem ipsum dolor, <mark>consectetur</mark> adipiscing...

Page 31: Performance Optimization for Mobile Web | Fresh Tilled Soil

USE New Markup & Semantics

<output>

<form oninput="result.value=a.valueAsNumber + b.valueAsNumber">0<input type="range" name="b">100 +<input type="number" name="a"> =<output name="result"></output></form>

Page 32: Performance Optimization for Mobile Web | Fresh Tilled Soil

USE: CSS & Image Techniques

● Use data URI's (inline images)

HTML

CSS

Page 33: Performance Optimization for Mobile Web | Fresh Tilled Soil

USE: CSS & Image Techniques

● Text paths using the SVG DOM

Page 34: Performance Optimization for Mobile Web | Fresh Tilled Soil

USE: CSS & Image Techniques

● Use inline SVG for charts and shape-based images

Page 35: Performance Optimization for Mobile Web | Fresh Tilled Soil

USE: CSS & Image Techniques (cont'd)

● Use online image optimizers to optimize images

● Use PNG over GIF

● Use CSS for animations & images whenever possible

● Use image transforms that force hardware graphic

acceleration and smoother rendering:

Page 36: Performance Optimization for Mobile Web | Fresh Tilled Soil

THE FUTURE OF MOBILEMozilla, Google, and Opera are working very hard toward making the web competitive with mobile native frameworks!

Promising Features Include:● WebRTC● WebAudio● WebVideo● PeerConnection● emscripten & porting w/ new JS features

http://AreWeMobileYet.comhttps://wiki.mozilla.org/WebAPIhttp://webrtc.org

Page 37: Performance Optimization for Mobile Web | Fresh Tilled Soil

What We've Covered:

● Brief Overview of the Mobile Web

● Testing, Measuring and Debugging

● Mobile Web Performance Optimization Areas

● Future of the Mobile Web

Page 38: Performance Optimization for Mobile Web | Fresh Tilled Soil

LOVE TO EVOLVE

LEARN

○ Responsive Design

○ Progressive Enhancement

○ Mobile First Design Approach

○ Latest HTML5, CSS3, and JS

○ JS Optimization Patterns

○ SVG, Canvas, and webGL

○ New Web API's

FORGET

○ Static Designs

○ Desktop Web Frameworks

(okay, not always)

○ Unlimited Power

○ Pixels

○ Screen Consistency

○ Always Connected

TAKE WHAT YOU'VE LEARNED AND CREATE LOTS OF COOL MOBILE & POWERFUL MOBILE WEBSITES

Page 39: Performance Optimization for Mobile Web | Fresh Tilled Soil

REFERENCE LINKS1. http://mobilehtml5.org - HTML5 Compatibility on Mobile & Tablet Browsers

2. http://caniuse.com - Campatibility tables for support of HTML5, CSS4, SVG, and more in

desktop & mobile browsers

3. http://www.onbile.com/info/the-most-popular-mobile-browsers

4. http://thenounproject.com/