SlideShare a Scribd company logo
@yottaa #WebPerf
So you want to build a
mobile app…
Brought to you by:
@yottaa #WebPerf
Available info, tooling driven by market
http://ti.me/18FeIn4
@yottaa #WebPerf
Prioritize based on volume
Share (%) of Smartphone Subscribers
January 2013 April 2013 Delta
Google 52.3% 52.0% -0.3%
Apple 37.8% 39.2% 1.4%
BlackBerry 5.9% 5.1% -0.8%
Microsoft 3.1% 3.0% -0.1%
Symbian 0.5% 0.5% 0.0%
http://bit.ly/1bRw6FC
@yottaa #WebPerf
Prioritize further: who are your users?
Your momma’s… got game!
It’s actually Gen-Xers.
Millennials are into
fitness & entertainment
http://blog.flurry.com/
@yottaa #WebPerf
What do your target users do and use?
80% of mobile
interaction is via
native apps
HTML5 apps are
great for:
• Productivity
• News
• Generally - forms
http://bit.ly/17G1Ng5
@yottaa #WebPerf
Why are only 6% of apps HTML5?
No app store makes
it more difficult to
monetize
Build once, run
everywhere
translates to optimize
everywhere
HTML5’s “good
enough” experience
isn’t always good
enough
@yottaa #WebPerf
For LinkedIN it the ecosystem was lacking
2012: HTML5 for efficiency & agility
8-10%
Mobile
users
Apps
running
out of
Memory
Lacked
testing &
profiling
2013: Native for user experience
Majority of
Traffic from
mobile
Better
features (use
HTML5, CSS
for email)
Apple and
Google drive
innovation
http://bit.ly/15NdyAg
@yottaa #WebPerf
High-level Overview
Governing body: W3C
• 5 years to ratify…
• 200+ browser
interpretations
More security
vulnerabilities
• Can’t encrypt cached
data
• Encrypting data in motion
compromises
performance
@yottaa #WebPerf
High-level Overview
Governing bodies: Apple and
Google
• At least one release/year
• iOS is highly standardized
& regulated
• More Android variety, but
still finite (~30 varieties vs.
over 200 for HTML5)
Better user experience
• Fewer security
vulnerabilities
• Device-specific
functionality is richer
@yottaa #WebPerf
OK, to be fair…
http://blog.flurry.com
Over the past two years, Android has had 21 updates to their browser.
@yottaa #WebPerf
What do you hold most dear?
1. User experience
2. Performance
3. Monetization
4. X-plat deployment $$
5. Fragmentation
6. Programming expertise
7. Updates & distribution
8. New innovation timeline
9. Security
@yottaa #WebPerf
A bit of trivia
http://bit.ly/15iQlqz
STARTUP TIME W/8 TABS
AVERAGE STARTUP TIME
40-TAB LOAD (CACHED, HOT)
WEBKIT SUNSPIDER
JSBENCH
FACEBOOK JSGAMEBENCH
HARDWARE ACCELERATION
PAGE LOAD RELIABILITY
OVERALL WINNER
@yottaa #WebPerf
Test…Testing…Testing 1, 2, 3
Question: How do your features
Appear to
your users?
Behave in
the wild?
Impact the
device?
Perform across
networks?
@yottaa #WebPerf
Appearances
http://bit.ly/133ijam
@yottaa #WebPerf
To Emulate or Simulate?
Emulator
• Mimics device hardware & software
• Android developers tend to complain about
performance
• Emulates GPU but tends to lag (instructions translated
to x86)
Simulator
• Mimics device software
• Apple stresses device testing b/c disk space, CPU &
memory speed different
• Faster cycle times, but requires recompiling to device
http://bit.ly/17G2hTH
@yottaa #WebPerf
How to determine browser features
• UA sniffing
– Poor choice – detects
navigator.userAgent
– User agent string may have changed
– New browser versions or flavors
• Feature detection
– HTML5 + CSS3
– JavaScript
@yottaa #WebPerf
rng.io - Ringmark
OSS maintained by Facebook @
https://github.com/facebook/rng.io
Native UX testing & development
Works with existing W3C tests
Full list of supported features across
browsers: http://bit.ly/1c0jDOj
Check whether an API is usable &
produces expected, specified output
@yottaa #WebPerf
Grab the brass browser ring
Ring 0
State of the world today.
Actively used mobile web features.
• Application Cache
• Canvas
• CSS 2.1
• CSS 3D Transforms
• CSS3 Animation
• CSS3 Background
• CSS3 Color
• CSS Min, Max
• CSS Opacity
• CSS3 Text
• CSS3 2D Transforms
• CSS3 Transitions
• CSS3 UI
• CSS3 Values
• Data URL
• Doctype
• Geolocation
• JSON
• Masking Images
• Web Messaging
• Progress Event
• Prompts
• Selectors 2
• Video
• Viewport
• Web Storage
Ring 1
Enable 2D game, audio, video, camera
Most popular types of mobile apps today.
• Audio, Multi-Track
• Blob
• CSS3 Background, Standard
• CSS3 Fonts
• CSS3 MediaQueries
• CSS Overflow Scrolling
• CSS Position Fixed
• CSS3 Text, Standard
• CSS3 UI, Standard
• Device Orientation Event
• FileReader
• FormData
• HTML5 Forms, Inputs
• Hashchange
• History
• Media Capture Input
• IndexedDB
• Multi Touch Event
• Offline Mode
• Ring 1 Performance
• Touch Event
• URL
• Web Workers
• XHR2
Ring 2
3D games, messaging, video streaming
Work in progress.
• Animation Timing
• Canvas 3D
• Canvas 3D, Standard
• CSS Unspecified
• CSS3 Animation, Standard
• CSS3 BorderImage
• CSS Element
• CSS3 Flexbox
• CSS3 Flexbox, Standard
• CSS3 Images
• CSS3 Images, Standard
• CSS Overflow Scrolling, Standard
• CSS3 2D Transforms, Standard
• CSS3 Transitions, Standard
• Custom Data Attributes
• Fullscreen
• HTML5 Layout & Semantic
• Iframe Sandboxing
• IndexedDB, Standard
• Performance Timing
• Network Info
• Notifications
• Ring 2 Performance
• SharedWorkers
• SVG
• SVG Animation
• SVG Inline
• Video Tracks
• Vibration
• Page Visibility
• WebRTC (Real time Audio & Video)
@yottaa #WebPerf
How Ringmark works
test("postMessage", function() {
var postMessage = window.postMessage;
assert( !!postMessage, "postMessage supported" );
});
test("onmessage", function() {
assert( "onmessage" in window, "onmessage supported" );
});
asyncTest("postMessage/onmessage In Practice", function( async ) {
window.onmessage = function( event ) {
async.step(function() {
assert( true, "onmessage event fired" );
assert( event.data === "This is Ground Control", "message
content matched expected" );
async.done();
});
};
window.postMessage( "This is Ground Control", "*" );
});
@yottaa #WebPerf
Lord of the Rings: Dolphin (and BB10)
Also: http://www.browserscope.org/?category=ringmark&v=top-m
http://www.youtube.com/watch?v=8KAXh81hIwY
@yottaa #WebPerf
Modernizr
javascript library
For development
with HTML5 + CSS3
Ensure support for
old browsers
Checks for native
browser support of
new web features
Generates custom
object to test what
you need
@yottaa #WebPerf
Example method in Modernizr
Polyfills are
scripts that
simulate the
behavior of
native API in
older browsers
This method:
Modernizr.load
has been
released
standalone as
yesnope.js
Modernizr.load([
{
// Logical list of things we would normally need
test : Modernizr.fontface && Modernizr.canvas && Modernizr.cssgradients,
// Modernizr.load loads css and javascript by default
nope : ['presentational-polyfill.js', 'presentational.css']
},
// Functional polyfills
{
// This just has to be truthy
test : Modernizr.websockets && window.JSON,
// socket-io.js and json2.js
nope : 'functional-polyfills.js',
// You can also give arrays of resources to load.
both : [ 'app.js', 'extra.js' ],
complete : function () {
// Run this after everything in this group has downloaded
// and executed, as well everything in all previous groups
myApp.init();
}
},
// Run analytics after you've already run the rest of your app.
'post-analytics.js'
]);
@yottaa #WebPerf
Using Modernizr
Modernizr.load([
{
load: '//ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.js',
complete: function () {
if ( !window.jQuery ) {
Modernizr.load('js/libs/jquery-1.7.1.min.js');
}
}
},
{
// This will wait for the fallback to load and
// execute if it needs to.
load: 'needs-jQuery.js'
}
]);
• Modernizr attempts
to load a script that
requires jQuery
• Immediately after, it
tests to determine
whether the jQuery
object is available
• If not, loads a local
copy of jQuery
WIN: Modernizr.load
handles the execution
order for you.
@yottaa #WebPerf
Useful Links
The All-In-One Entirely-Not-Alphabetical No-
Bullshit Guide to HTML5 Fallbacks (yes, really)
http://bit.ly/12griWY
Writing Cross-Browser JavaScript Polyfills
http://addyosmani.com/blog/writing-polyfills/
Ultimate Guide to Mobile Emulators & Simulators
http://www.mobilexweb.com/emulators
@yottaa #WebPerf
Has.js
phiggins42./has.js
on Github
For development
with JavaScript
Self-contained tests
& unified framework
Checks for native
browser support of
JavaScript features
Modular/a-la-carte to
test only what you
need
if(has("function-
bind")){
// your enviroment
has a native
Function.prototype.bin
d
}else{
// you should get
a new browser.
}
@yottaa #WebPerf
Networks
@yottaa #WebPerf
@yottaa #WebPerf
AT&T Application Resource Optimizer
• All Platforms
– pcap/tcpdump network trace
– Wi-Fi Hotspot + Wireshark/NetMon
• iOS
– Remote Virtual Interface
– Uses Instruments to collect pcap over 3G/LTE
• Android
– Native Collector
– Requires root
https://github.com/attdevsupport/ARO
@yottaa #WebPerf
Close Connections
HttpURLConnection getimagecloseconn = (HttpURLConnection)
urln.openConnection();
getimagecloseconn.setRequestProperty("connection", "close");
getimagecloseconn.connect();
String cachecontrol = getimagecloseconn.getHeaderField("Cache-
Control"); InputStream isclose =
getimagecloseconn.getInputStream();
bitmap = BitmapFactory.decodeStream(isclose);
getimagecloseconn.disconnect();
>80% of apps DO NOT close connections!
@yottaa #WebPerf
Cache Your Data
• 17% of mobile traffic is duplicate downloads
– Reading from local cache is 75-99% faster than downloading
from the web
– Even when supported, it’s OFF by default!!
• Each file uniquely tagged, revalidated for
reach request
– Requests use the radio, drain the battery
– Also add 500-3,000 ms of latency
• Carefully assign Max-Age times
– App won’t check for the file on server until reached
– Retrieval is strictly file processing: up to 98% faster, no radio
http://soc.att.com/138bhRJ http://yhoo.it/1c6wcHV
@yottaa #WebPerf
Manage Connections
if (Tel.getDataActivity() >0){
if (Tel.getDataActivity() <4){
//ok, we are passed the minimum time to check //and we found
network activity-
//download the image here using image getter
imagegetter(counter, numberofimages); //and show the ad
AdRequest adRequest = new AdRequest();
adRequest.addTestDevice(AdRequest.TEST_EMULATOR);
adView.loadAd(adRequest);
// Initiate a generic request to load it with an ad
adView.loadAd(new AdRequest());
Grouping data, ads, analytics can save > 50%
@yottaa #WebPerf
Real Life
@yottaa #WebPerf
@yottaa #WebPerf
DIY - Move Yourself
• Lose the signal
– Find a basement or elevator
• Mix it up
– Walk in and out of WiFi areas
• Have a cuppa
– Find slow, saturated WiFi (coffee shop, train)
• Shut up and drive
– Ride along in a car to swap towers, signals
• Paint a picture
– Map your findings to understand and prioritize
http://bit.ly/14MOmNr
@yottaa #WebPerf
Device
@yottaa #WebPerf
@yottaa #WebPerf
Yottaa
Mobile Performance Testing
Understand performance across the globe
See iOS and Android end user rendering (diffs)
Verify graceful degradation across various networks
Mobile Monitoring
Eliminate downtime, errors
Understand site performance & competitive position
Prioritize optimization, feature work w/historical analysis
Mobile Optimization
Overcome slow / variable networks with adaptive infrastructure
Optimize dynamic content: offload bandwidth, intelligently cache, adapt images
Maximize user experience with federated CDN delivery, global server load balancing
Guarantee availability and network elasticity by analyzing and managing traffic
http://www.yottaa.com
@yottaa #WebPerf
In Summary
Heavily tested hybrid apps are most likely the ideal solution
Native is more
work, but nets a
better experience
There is no
substitute for real
world testing
If there’s a tool, use
it! ARO, Ringmark,
Modernizr, Yottaa
Mobile networks are
unreliable. Code for
graceful degradation
@yottaa #WebPerf
Thank You!
Follow us! @yottaa
www.yottaa.com/signup
@yottaa #WebPerf

More Related Content

PDF
Testing Mobile JavaScript
PDF
Extreme Web Performance for Mobile Devices - Velocity NY
KEY
Developing High Performance Web Apps - CodeMash 2011
PDF
Learning from the Best jQuery Plugins
PDF
Why HTML5 is getting on my nerves…
PDF
High Performance JavaScript - WebDirections USA 2010
PDF
Innovation vs. Impatience - keynote at JSOpenDay London 2015
PPTX
One code Web, iOS, Android
Testing Mobile JavaScript
Extreme Web Performance for Mobile Devices - Velocity NY
Developing High Performance Web Apps - CodeMash 2011
Learning from the Best jQuery Plugins
Why HTML5 is getting on my nerves…
High Performance JavaScript - WebDirections USA 2010
Innovation vs. Impatience - keynote at JSOpenDay London 2015
One code Web, iOS, Android

What's hot (20)

PPTX
Testing Single Page Webapp
PDF
High Performance Web Design
PDF
Avoiding Common Pitfalls in Ember.js
PDF
Cloud Foundry API for Fun and Ops
PPTX
Mobile native-hacks
KEY
Kirin - Making Single Page Web Apps with a Native UI
PPTX
jQuery Conference 2012 keynote
PPTX
Conversionista : Conversion manager course - Stockholm 20 march 2013
PDF
HTML5 or Android for Mobile Development?
PDF
EuroPython 2011 - How to build complex web applications having fun?
PDF
Gears and HTML 5 @media Ajax London 2008
PDF
Hybrid application development
PDF
JavaScript Libraries: The Big Picture
PDF
Flexible UI Components for a Multi-Framework World
PDF
Get Hip with JHipster - Colorado Springs OSS Meetup April 2016
PPTX
Best Practices in SharePoint Development - Just Freakin Work! Overcoming Hurd...
PDF
Get Hip with JHipster: Spring Boot + AngularJS + Bootstrap - Devoxx UK 2016
PPTX
Testing your Single Page Application
KEY
Natural Language UI Testing using Behavior Driven Development with Pavlov and...
PDF
Codemotion Progressive Web Applications Pwa Webinar - Jorge Ferreiro - @jgfer...
Testing Single Page Webapp
High Performance Web Design
Avoiding Common Pitfalls in Ember.js
Cloud Foundry API for Fun and Ops
Mobile native-hacks
Kirin - Making Single Page Web Apps with a Native UI
jQuery Conference 2012 keynote
Conversionista : Conversion manager course - Stockholm 20 march 2013
HTML5 or Android for Mobile Development?
EuroPython 2011 - How to build complex web applications having fun?
Gears and HTML 5 @media Ajax London 2008
Hybrid application development
JavaScript Libraries: The Big Picture
Flexible UI Components for a Multi-Framework World
Get Hip with JHipster - Colorado Springs OSS Meetup April 2016
Best Practices in SharePoint Development - Just Freakin Work! Overcoming Hurd...
Get Hip with JHipster: Spring Boot + AngularJS + Bootstrap - Devoxx UK 2016
Testing your Single Page Application
Natural Language UI Testing using Behavior Driven Development with Pavlov and...
Codemotion Progressive Web Applications Pwa Webinar - Jorge Ferreiro - @jgfer...
Ad

Viewers also liked (11)

PDF
Building Native Mobile Applications with PhoneGap
PPTX
Native Mobile Apps, Xamarin, and PhoneGap
PPT
Harvard referencing system
PDF
Tools and Techniques for mobile learning
PPTX
Native vs hybrid approach Mobile App Development
PDF
How to Make a Native Mobile App with WordPress
PPTX
Top 4 Cross Platform tools for Mobile App Development
PDF
Developing and Designing Native Mobile Apps in Visual Studio
PDF
Developing and Designing Native Mobile Apps in Xamarin Studio
PPTX
Introduction To Mobile Application Development
PPT
Mobile Application Development
Building Native Mobile Applications with PhoneGap
Native Mobile Apps, Xamarin, and PhoneGap
Harvard referencing system
Tools and Techniques for mobile learning
Native vs hybrid approach Mobile App Development
How to Make a Native Mobile App with WordPress
Top 4 Cross Platform tools for Mobile App Development
Developing and Designing Native Mobile Apps in Visual Studio
Developing and Designing Native Mobile Apps in Xamarin Studio
Introduction To Mobile Application Development
Mobile Application Development
Ad

Similar to So you want to build a mobile app - HTML5 vs. Native @ the Boston Mobile Experience Optimization Meetup (20)

KEY
HTML5 is the Future of Mobile, PhoneGap Takes You There Today
PDF
John Resig Beijing 2010 (English Version)
PDF
Mobile App Development
PDF
移动端Web app开发
KEY
PDF
Hybrid mobile apps
PDF
The Mobile Web Revealed For The Java Developer
KEY
Phonegap for Engineers
PPTX
Image-ine That: Image Optimization for Conversion Maximization
PPT
State of jQuery - AspDotNetStorefront Conference
PDF
Extreme Web Performance for Mobile Devices - Velocity Barcelona 2014
KEY
Philly ete-2011
KEY
HTML5 and the Mobile Web
PPTX
Hybrid Mobile Development with Apache Cordova and
PDF
Velocity building a performance lab for mobile apps in a day - final
PPTX
Building AR and VR Experiences for Web Apps with JavaScript
KEY
Js On Mobile Devices
KEY
Future of Mobile
PPTX
Hybrid Mobile Development with Apache Cordova and Java EE 7 (JavaOne 2014)
KEY
Fake it 'til you make it
HTML5 is the Future of Mobile, PhoneGap Takes You There Today
John Resig Beijing 2010 (English Version)
Mobile App Development
移动端Web app开发
Hybrid mobile apps
The Mobile Web Revealed For The Java Developer
Phonegap for Engineers
Image-ine That: Image Optimization for Conversion Maximization
State of jQuery - AspDotNetStorefront Conference
Extreme Web Performance for Mobile Devices - Velocity Barcelona 2014
Philly ete-2011
HTML5 and the Mobile Web
Hybrid Mobile Development with Apache Cordova and
Velocity building a performance lab for mobile apps in a day - final
Building AR and VR Experiences for Web Apps with JavaScript
Js On Mobile Devices
Future of Mobile
Hybrid Mobile Development with Apache Cordova and Java EE 7 (JavaOne 2014)
Fake it 'til you make it

More from Yottaa (18)

PPTX
2016: The Year to Align Marketing & IT Departments
PPTX
Optimizing Website Performance in the Age of Mobile & Social
PPTX
NextGen CDNs: Webinar with Dan Rayburn of Frost and Sullivan and Ari Weil of ...
PPTX
How to Optimize Your Entire Mobile Experience
PPTX
Monetizing Mobile: How To Optimize Mobile Engagement and Conversions
PPTX
Beyond CDNs: How to Harness the Next Phase of Innovation in Web Performance
PPTX
Yottaa State of Web Performance Optimization Group Webinar
PPTX
Mobile Optimization Tips from Yottaa - MEGMeetup #1
PPTX
Best practices to optimize commerce site performance [webinar slides]
PPTX
Managing a Website Performance Optimization (WPO) Project
PDF
How GoDaddy Brought Down Millions of Sites – and How to Avoid Being a DNS Out...
PPTX
An Expert's Guide to Making a Website Slow - Chicago Webmasters Meetup 6/5/2012
PPTX
Cdn-Summit-2012-mocospace-and-yottaa
PPTX
Your customer your asset seminar ecommerce and website speed yottaa
PPTX
Anti design patterns - an experts guide to making a slow website - yottaa sit...
PPTX
Yottaa site speed optimizer presentation at mass innovation nights part of fu...
PPTX
Yottaa website-performance-services-overview-hostingcon-2011-
PPTX
Mongodb beijingconf yottaa_3.3
2016: The Year to Align Marketing & IT Departments
Optimizing Website Performance in the Age of Mobile & Social
NextGen CDNs: Webinar with Dan Rayburn of Frost and Sullivan and Ari Weil of ...
How to Optimize Your Entire Mobile Experience
Monetizing Mobile: How To Optimize Mobile Engagement and Conversions
Beyond CDNs: How to Harness the Next Phase of Innovation in Web Performance
Yottaa State of Web Performance Optimization Group Webinar
Mobile Optimization Tips from Yottaa - MEGMeetup #1
Best practices to optimize commerce site performance [webinar slides]
Managing a Website Performance Optimization (WPO) Project
How GoDaddy Brought Down Millions of Sites – and How to Avoid Being a DNS Out...
An Expert's Guide to Making a Website Slow - Chicago Webmasters Meetup 6/5/2012
Cdn-Summit-2012-mocospace-and-yottaa
Your customer your asset seminar ecommerce and website speed yottaa
Anti design patterns - an experts guide to making a slow website - yottaa sit...
Yottaa site speed optimizer presentation at mass innovation nights part of fu...
Yottaa website-performance-services-overview-hostingcon-2011-
Mongodb beijingconf yottaa_3.3

Recently uploaded (20)

PDF
Chapter 2 Heredity, Prenatal Development, and Birth.pdf
PDF
2.FourierTransform-ShortQuestionswithAnswers.pdf
PPTX
The Healthy Child – Unit II | Child Health Nursing I | B.Sc Nursing 5th Semester
PPTX
Cell Types and Its function , kingdom of life
PDF
grade 11-chemistry_fetena_net_5883.pdf teacher guide for all student
PDF
BÀI TẬP BỔ TRỢ 4 KỸ NĂNG TIẾNG ANH 9 GLOBAL SUCCESS - CẢ NĂM - BÁM SÁT FORM Đ...
PDF
Complications of Minimal Access Surgery at WLH
PDF
Module 4: Burden of Disease Tutorial Slides S2 2025
PDF
01-Introduction-to-Information-Management.pdf
PPTX
Renaissance Architecture: A Journey from Faith to Humanism
PDF
Supply Chain Operations Speaking Notes -ICLT Program
PDF
TR - Agricultural Crops Production NC III.pdf
PPTX
IMMUNITY IMMUNITY refers to protection against infection, and the immune syst...
PPTX
Introduction_to_Human_Anatomy_and_Physiology_for_B.Pharm.pptx
PDF
STATICS OF THE RIGID BODIES Hibbelers.pdf
PPTX
school management -TNTEU- B.Ed., Semester II Unit 1.pptx
PPTX
Pharmacology of Heart Failure /Pharmacotherapy of CHF
PDF
The Lost Whites of Pakistan by Jahanzaib Mughal.pdf
PDF
Microbial disease of the cardiovascular and lymphatic systems
PDF
3rd Neelam Sanjeevareddy Memorial Lecture.pdf
Chapter 2 Heredity, Prenatal Development, and Birth.pdf
2.FourierTransform-ShortQuestionswithAnswers.pdf
The Healthy Child – Unit II | Child Health Nursing I | B.Sc Nursing 5th Semester
Cell Types and Its function , kingdom of life
grade 11-chemistry_fetena_net_5883.pdf teacher guide for all student
BÀI TẬP BỔ TRỢ 4 KỸ NĂNG TIẾNG ANH 9 GLOBAL SUCCESS - CẢ NĂM - BÁM SÁT FORM Đ...
Complications of Minimal Access Surgery at WLH
Module 4: Burden of Disease Tutorial Slides S2 2025
01-Introduction-to-Information-Management.pdf
Renaissance Architecture: A Journey from Faith to Humanism
Supply Chain Operations Speaking Notes -ICLT Program
TR - Agricultural Crops Production NC III.pdf
IMMUNITY IMMUNITY refers to protection against infection, and the immune syst...
Introduction_to_Human_Anatomy_and_Physiology_for_B.Pharm.pptx
STATICS OF THE RIGID BODIES Hibbelers.pdf
school management -TNTEU- B.Ed., Semester II Unit 1.pptx
Pharmacology of Heart Failure /Pharmacotherapy of CHF
The Lost Whites of Pakistan by Jahanzaib Mughal.pdf
Microbial disease of the cardiovascular and lymphatic systems
3rd Neelam Sanjeevareddy Memorial Lecture.pdf

So you want to build a mobile app - HTML5 vs. Native @ the Boston Mobile Experience Optimization Meetup

  • 1. @yottaa #WebPerf So you want to build a mobile app… Brought to you by:
  • 2. @yottaa #WebPerf Available info, tooling driven by market http://ti.me/18FeIn4
  • 3. @yottaa #WebPerf Prioritize based on volume Share (%) of Smartphone Subscribers January 2013 April 2013 Delta Google 52.3% 52.0% -0.3% Apple 37.8% 39.2% 1.4% BlackBerry 5.9% 5.1% -0.8% Microsoft 3.1% 3.0% -0.1% Symbian 0.5% 0.5% 0.0% http://bit.ly/1bRw6FC
  • 4. @yottaa #WebPerf Prioritize further: who are your users? Your momma’s… got game! It’s actually Gen-Xers. Millennials are into fitness & entertainment http://blog.flurry.com/
  • 5. @yottaa #WebPerf What do your target users do and use? 80% of mobile interaction is via native apps HTML5 apps are great for: • Productivity • News • Generally - forms http://bit.ly/17G1Ng5
  • 6. @yottaa #WebPerf Why are only 6% of apps HTML5? No app store makes it more difficult to monetize Build once, run everywhere translates to optimize everywhere HTML5’s “good enough” experience isn’t always good enough
  • 7. @yottaa #WebPerf For LinkedIN it the ecosystem was lacking 2012: HTML5 for efficiency & agility 8-10% Mobile users Apps running out of Memory Lacked testing & profiling 2013: Native for user experience Majority of Traffic from mobile Better features (use HTML5, CSS for email) Apple and Google drive innovation http://bit.ly/15NdyAg
  • 8. @yottaa #WebPerf High-level Overview Governing body: W3C • 5 years to ratify… • 200+ browser interpretations More security vulnerabilities • Can’t encrypt cached data • Encrypting data in motion compromises performance
  • 9. @yottaa #WebPerf High-level Overview Governing bodies: Apple and Google • At least one release/year • iOS is highly standardized & regulated • More Android variety, but still finite (~30 varieties vs. over 200 for HTML5) Better user experience • Fewer security vulnerabilities • Device-specific functionality is richer
  • 10. @yottaa #WebPerf OK, to be fair… http://blog.flurry.com Over the past two years, Android has had 21 updates to their browser.
  • 11. @yottaa #WebPerf What do you hold most dear? 1. User experience 2. Performance 3. Monetization 4. X-plat deployment $$ 5. Fragmentation 6. Programming expertise 7. Updates & distribution 8. New innovation timeline 9. Security
  • 12. @yottaa #WebPerf A bit of trivia http://bit.ly/15iQlqz STARTUP TIME W/8 TABS AVERAGE STARTUP TIME 40-TAB LOAD (CACHED, HOT) WEBKIT SUNSPIDER JSBENCH FACEBOOK JSGAMEBENCH HARDWARE ACCELERATION PAGE LOAD RELIABILITY OVERALL WINNER
  • 13. @yottaa #WebPerf Test…Testing…Testing 1, 2, 3 Question: How do your features Appear to your users? Behave in the wild? Impact the device? Perform across networks?
  • 15. @yottaa #WebPerf To Emulate or Simulate? Emulator • Mimics device hardware & software • Android developers tend to complain about performance • Emulates GPU but tends to lag (instructions translated to x86) Simulator • Mimics device software • Apple stresses device testing b/c disk space, CPU & memory speed different • Faster cycle times, but requires recompiling to device http://bit.ly/17G2hTH
  • 16. @yottaa #WebPerf How to determine browser features • UA sniffing – Poor choice – detects navigator.userAgent – User agent string may have changed – New browser versions or flavors • Feature detection – HTML5 + CSS3 – JavaScript
  • 17. @yottaa #WebPerf rng.io - Ringmark OSS maintained by Facebook @ https://github.com/facebook/rng.io Native UX testing & development Works with existing W3C tests Full list of supported features across browsers: http://bit.ly/1c0jDOj Check whether an API is usable & produces expected, specified output
  • 18. @yottaa #WebPerf Grab the brass browser ring Ring 0 State of the world today. Actively used mobile web features. • Application Cache • Canvas • CSS 2.1 • CSS 3D Transforms • CSS3 Animation • CSS3 Background • CSS3 Color • CSS Min, Max • CSS Opacity • CSS3 Text • CSS3 2D Transforms • CSS3 Transitions • CSS3 UI • CSS3 Values • Data URL • Doctype • Geolocation • JSON • Masking Images • Web Messaging • Progress Event • Prompts • Selectors 2 • Video • Viewport • Web Storage Ring 1 Enable 2D game, audio, video, camera Most popular types of mobile apps today. • Audio, Multi-Track • Blob • CSS3 Background, Standard • CSS3 Fonts • CSS3 MediaQueries • CSS Overflow Scrolling • CSS Position Fixed • CSS3 Text, Standard • CSS3 UI, Standard • Device Orientation Event • FileReader • FormData • HTML5 Forms, Inputs • Hashchange • History • Media Capture Input • IndexedDB • Multi Touch Event • Offline Mode • Ring 1 Performance • Touch Event • URL • Web Workers • XHR2 Ring 2 3D games, messaging, video streaming Work in progress. • Animation Timing • Canvas 3D • Canvas 3D, Standard • CSS Unspecified • CSS3 Animation, Standard • CSS3 BorderImage • CSS Element • CSS3 Flexbox • CSS3 Flexbox, Standard • CSS3 Images • CSS3 Images, Standard • CSS Overflow Scrolling, Standard • CSS3 2D Transforms, Standard • CSS3 Transitions, Standard • Custom Data Attributes • Fullscreen • HTML5 Layout & Semantic • Iframe Sandboxing • IndexedDB, Standard • Performance Timing • Network Info • Notifications • Ring 2 Performance • SharedWorkers • SVG • SVG Animation • SVG Inline • Video Tracks • Vibration • Page Visibility • WebRTC (Real time Audio & Video)
  • 19. @yottaa #WebPerf How Ringmark works test("postMessage", function() { var postMessage = window.postMessage; assert( !!postMessage, "postMessage supported" ); }); test("onmessage", function() { assert( "onmessage" in window, "onmessage supported" ); }); asyncTest("postMessage/onmessage In Practice", function( async ) { window.onmessage = function( event ) { async.step(function() { assert( true, "onmessage event fired" ); assert( event.data === "This is Ground Control", "message content matched expected" ); async.done(); }); }; window.postMessage( "This is Ground Control", "*" ); });
  • 20. @yottaa #WebPerf Lord of the Rings: Dolphin (and BB10) Also: http://www.browserscope.org/?category=ringmark&v=top-m http://www.youtube.com/watch?v=8KAXh81hIwY
  • 21. @yottaa #WebPerf Modernizr javascript library For development with HTML5 + CSS3 Ensure support for old browsers Checks for native browser support of new web features Generates custom object to test what you need
  • 22. @yottaa #WebPerf Example method in Modernizr Polyfills are scripts that simulate the behavior of native API in older browsers This method: Modernizr.load has been released standalone as yesnope.js Modernizr.load([ { // Logical list of things we would normally need test : Modernizr.fontface && Modernizr.canvas && Modernizr.cssgradients, // Modernizr.load loads css and javascript by default nope : ['presentational-polyfill.js', 'presentational.css'] }, // Functional polyfills { // This just has to be truthy test : Modernizr.websockets && window.JSON, // socket-io.js and json2.js nope : 'functional-polyfills.js', // You can also give arrays of resources to load. both : [ 'app.js', 'extra.js' ], complete : function () { // Run this after everything in this group has downloaded // and executed, as well everything in all previous groups myApp.init(); } }, // Run analytics after you've already run the rest of your app. 'post-analytics.js' ]);
  • 23. @yottaa #WebPerf Using Modernizr Modernizr.load([ { load: '//ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.js', complete: function () { if ( !window.jQuery ) { Modernizr.load('js/libs/jquery-1.7.1.min.js'); } } }, { // This will wait for the fallback to load and // execute if it needs to. load: 'needs-jQuery.js' } ]); • Modernizr attempts to load a script that requires jQuery • Immediately after, it tests to determine whether the jQuery object is available • If not, loads a local copy of jQuery WIN: Modernizr.load handles the execution order for you.
  • 24. @yottaa #WebPerf Useful Links The All-In-One Entirely-Not-Alphabetical No- Bullshit Guide to HTML5 Fallbacks (yes, really) http://bit.ly/12griWY Writing Cross-Browser JavaScript Polyfills http://addyosmani.com/blog/writing-polyfills/ Ultimate Guide to Mobile Emulators & Simulators http://www.mobilexweb.com/emulators
  • 25. @yottaa #WebPerf Has.js phiggins42./has.js on Github For development with JavaScript Self-contained tests & unified framework Checks for native browser support of JavaScript features Modular/a-la-carte to test only what you need if(has("function- bind")){ // your enviroment has a native Function.prototype.bin d }else{ // you should get a new browser. }
  • 27. @yottaa #WebPerf AT&T Application Resource Optimizer • All Platforms – pcap/tcpdump network trace – Wi-Fi Hotspot + Wireshark/NetMon • iOS – Remote Virtual Interface – Uses Instruments to collect pcap over 3G/LTE • Android – Native Collector – Requires root https://github.com/attdevsupport/ARO
  • 28. @yottaa #WebPerf Close Connections HttpURLConnection getimagecloseconn = (HttpURLConnection) urln.openConnection(); getimagecloseconn.setRequestProperty("connection", "close"); getimagecloseconn.connect(); String cachecontrol = getimagecloseconn.getHeaderField("Cache- Control"); InputStream isclose = getimagecloseconn.getInputStream(); bitmap = BitmapFactory.decodeStream(isclose); getimagecloseconn.disconnect(); >80% of apps DO NOT close connections!
  • 29. @yottaa #WebPerf Cache Your Data • 17% of mobile traffic is duplicate downloads – Reading from local cache is 75-99% faster than downloading from the web – Even when supported, it’s OFF by default!! • Each file uniquely tagged, revalidated for reach request – Requests use the radio, drain the battery – Also add 500-3,000 ms of latency • Carefully assign Max-Age times – App won’t check for the file on server until reached – Retrieval is strictly file processing: up to 98% faster, no radio http://soc.att.com/138bhRJ http://yhoo.it/1c6wcHV
  • 30. @yottaa #WebPerf Manage Connections if (Tel.getDataActivity() >0){ if (Tel.getDataActivity() <4){ //ok, we are passed the minimum time to check //and we found network activity- //download the image here using image getter imagegetter(counter, numberofimages); //and show the ad AdRequest adRequest = new AdRequest(); adRequest.addTestDevice(AdRequest.TEST_EMULATOR); adView.loadAd(adRequest); // Initiate a generic request to load it with an ad adView.loadAd(new AdRequest()); Grouping data, ads, analytics can save > 50%
  • 32. @yottaa #WebPerf DIY - Move Yourself • Lose the signal – Find a basement or elevator • Mix it up – Walk in and out of WiFi areas • Have a cuppa – Find slow, saturated WiFi (coffee shop, train) • Shut up and drive – Ride along in a car to swap towers, signals • Paint a picture – Map your findings to understand and prioritize http://bit.ly/14MOmNr
  • 34. @yottaa #WebPerf Yottaa Mobile Performance Testing Understand performance across the globe See iOS and Android end user rendering (diffs) Verify graceful degradation across various networks Mobile Monitoring Eliminate downtime, errors Understand site performance & competitive position Prioritize optimization, feature work w/historical analysis Mobile Optimization Overcome slow / variable networks with adaptive infrastructure Optimize dynamic content: offload bandwidth, intelligently cache, adapt images Maximize user experience with federated CDN delivery, global server load balancing Guarantee availability and network elasticity by analyzing and managing traffic http://www.yottaa.com
  • 35. @yottaa #WebPerf In Summary Heavily tested hybrid apps are most likely the ideal solution Native is more work, but nets a better experience There is no substitute for real world testing If there’s a tool, use it! ARO, Ringmark, Modernizr, Yottaa Mobile networks are unreliable. Code for graceful degradation
  • 36. @yottaa #WebPerf Thank You! Follow us! @yottaa www.yottaa.com/signup @yottaa #WebPerf

Editor's Notes

  • #7: Appcelerator/IDC’s Q2 2012 survey of 3,600+ developers found that 6% of applications were targeted for development in HTML5 1.25 million native applications versus 75,000 HTML5 applications in production today in public app stores: these are telling statistics.400,000,000 accounts tied to credit cards in Apple’s app store, This is the largest number of participants for a transactional site on the Internet. Consumers have downloaded 30 billion apps and Applehas written checks for over $5 billion to developers. The store is now available in over 155 countries around the world. However, costs can be prohibitive when building native applications on every required OS. In the same developer survey referenced above, 80% of developers expressed the need to deploy their applications on more than one operating system. Development team costs need to be doubled or tripled to deliver this native experience on multiple OSes (if those developers can even be found and hired).
  • #8: It’s ideal to keep rendered content for instant switching back. However you could only do that if memory management is done optimally. There’s only so much you could keep until the app crashes running out of memory.
  • #11: Over 28 implementations by multiple manufacturers (e.g. HTC, Samsung, Motorola, Kindle, Google itself, Sony and more), the pains associated with writing an application for Android deployment are well documented.
  • #16: TouchOrientationGPSBandwidth
  • #23: https://github.com/Modernizr/Modernizr/wiki/HTML5-Cross-Browser-Polyfills
  • #24: It works by trying to load in the script, and then immediately after, testing to see if the jQuery object is available. If It’s not, then they load a local copy of jQuery as a fallback. This is generally not that easy in script-loaders, but Modernizr.load has got you covered. You can just use the same logic, and Modernizr.load will handle the execution order for you:
  • #26: https://github.com/phiggins42/has.js
  • #27: http://bit.ly/133ixOB
  • #29: https://github.com/attdevsupport/ARO/tree/master/2013DevSummitTurbocharge
  • #32: http://bit.ly/12Kl2lp
  • #34: http://bit.ly/12Klct4