SlideShare una empresa de Scribd logo
1 de 81
Descargar para leer sin conexión
http://www.flickr.com/photos/nzbuu/4093456029 
Are Today’s Good Practices… 
Tomorrow’s Performance Anti-Patterns? 
@andydavies 
#Akamai Edge, Oct 2014
One Christmas… 
http://www.flickr.com/photos/willypayne/3116395089
One Christmas… 
http://www.flickr.com/photos/willypayne/3116395089 
What if …! 
!
One Christmas… 
http://www.flickr.com/photos/willypayne/3116395089 
What if …! 
! 
… dataURIs are an anti-pattern?
dataURIs are a technique to reduce number of HTTP requests 
/images/redsquare.png 
.selector { 
background-image: url(/images/redsquare.png); 
}
Encode image as base64 string 
encode 
iVBORw0KGgoAAAANSUhEUgAAABk 
AAAAZCAMAAADzN3VRAAAAGXRFWH 
RTb2Z0d2FyZQBBZG9iZSBJbWFnZ 
VJlYWR5ccllPAAAAAZQTFRF/ 
wAAAAAAQaMSAwAAABJJREFUeNpi 
YBgFo2AwAIAAAwACigABtnCV2AA 
AAABJRU5ErkJggg== 
/images/redsquare.png base64 string
Replace image path with dataURI 
! 
.selector { 
background-image: url( 
! 
! 
! 
! 
! 
} 
data:image/ 
png;base64,iVBORw0KGgoAAAANSUhEUgAAABkA 
AAAZCAMAAADzN3VRAAAAGXRFWHRTb2Z0d2FyZQB 
BZG9iZSBJbWFnZVJlYWR5ccllPAAAAAZQTFRF/ 
wAAAAAAQaMSAwAAABJJREFUeNpiYBgFo2AwAIAA 
AwACigABtnCV2AAAAABJRU5ErkJggg==); 
dataURIs can also be used with other non-image elements too
Reduces number of requests but it’s a tradeoff 
Makes a blocking resource (CSS) larger by including non-blocking resources! 
• Browser can’t start rendering page until CSS has downloaded *! 
• Images don’t block! 
! 
Do they have the same caching lifetime?! 
Overrides browsers pre-loader heuristics 
* Some browsers defer download of CSS when media query doesn’t match
Test the theory 
http://www.flickr.com/photos/marc-flores/8367323660
1.Take 50 icons! 
2.Create 50 stylesheets, each with one 
more dataURI than previous! 
3.Create matching HTML file for each 
stylesheet! 
4.Test them all! (using WebPagetest)
Larger CSS download = longer time to RenderStart 
1000 
ms) 
875 
(TTFB - 750 
RenderStart 625 
500 
1 3 5 7 9 11 13 15 17 19 21 23 25 27 29 31 33 35 37 39 41 43 45 47 49 Number of Sprites
Larger CSS download = longer time to RenderStart 
1000 
ms) 
875 
(TTFB - 750 
RenderStart 625 
500 
1 3 5 7 9 11 13 15 17 19 21 23 25 27 29 31 33 35 37 39 41 43 45 47 49 Number of Sprites
This started me thinking! 
www.flickr.com/photos/irishwildcat/3020466221
We have our rules… 
http://www.flickr.com/photos/sowrey/2441134911
and we love recipes… 
http://www.flickr.com/photos/mrsmagic/2247364228
But, what happens when things change?
Browsers already use the network differently
Download order != Document order 
https://www.flickr.com/photos/add1sun/4993432274
Prioritisation sometimes has unexpected consequences 
Major UK retailer’s 
site in Chrome
Prioritisation sometimes has unexpected consequences 
These JS resources are 
at the foot of the body! 
(perhaps they should merge them into 
fewer resources but…)
Prioritisation sometimes has unexpected consequences 
The hero image is 
delayed as it waits for 
the JS to downloaded
New network protocols are coming here 
http://www.flickr.com/photos/jonlachance/3427660741
They use TCP connections differently 
HTTP 1.1 
SPDY
New standards present both opportunities and challenges
So how might this change what we do today?
How much do we rely on inline JavaScript? 
www.flickr.com/photos/jfraissi/6352877711
82% of visitors support async attribute 
! 
<script async src="script.js"></script> 
http://caniuse.com/script-async
82% of visitors support async attribute 
! 
<script async src="script.js"></script> 
http://caniuse.com/script-async 
Tells browsers they don’t need 
pause DOM construction while 
the JavaScript downloads and 
executes
Yet, this is how we typically load scripts asynchronously 
<script type="text/javascript"> 
(function() { 
var js = document.createElement('script'); 
js.async = true; 
js.src = 'script.js'; 
var e = document.getElementsByTagName('script')[0]; 
e.parentNode.insertBefore(js, first); 
})(); 
</script>
Yet, this is how we typically load scripts asynchronously 
<script type="text/javascript"> 
(function() { 
Browser won’t discover 
script until outer script 
inserts it into DOM 
var js = document.createElement('script'); 
js.async = true; 
js.src = 'script.js'; 
var e = document.getElementsByTagName('script')[0]; 
e.parentNode.insertBefore(js, first); 
})(); 
</script>
XSS
Content-Security-Policy 
“Content Security Policy, a mechanism web applications 
can use to mitigate a broad class of content injection 
vulnerabilities, such as cross-site scripting (XSS)” 
http://www.w3.org/TR/CSP/
Only allow scripts to be executed if they come from a designated host, 
disables inline scripts by default. 
Content-Security-Policy: script-src http://www.site.com 
Can re-enable inline scripts, but increases XSS risk 
Content-Security-Policy script-src 'self' 
Doesn’t just apply to scripts, can be used with CSS, fonts, images etc.
What other performance enhancements do we rely on inline JS for? 
The Guardian prioritise their content! 
! 
Divide page load into:! 
- Content! 
- Enhancements! 
- Leftovers ! 
! 
Some sites rely on scroll handlers for lazyloading
W3C Resource Priorities - adds lazyload attribute 
(also look at Ilya Grigorik’s proposal for Resource Hints)
So what about the network? 
http://www.flickr.com/photos/uwwresnet/5881727219
http://www.flickr.com/photos/7671591@N08/1469828976 
HTTP/1.x could use TCP more efficiently
We’ve been hacking around the gaps 
https://www.flickr.com/photos/rocketnumber9/13695281
Browsers added support for more parallel connections 
Old browsers - 2 parallel connections 
Today’s browsers - 4 plus connections
We split resources across domains 
www.bbc.co.uk! 
static.bbci.co.uk! 
news.bbcimg.co.uk! 
node1.bbcimg.co.uk
Use DataURIs to “push” assets 
! 
url( 
! 
! 
! 
! 
! 
! 
data:image/ 
png;base64,iVBORw0KGgoAAAANSUhEUgAAABkA 
AAAZCAMAAADzN3VRAAAAGXRFWHRTb2Z0d2FyZQB 
BZG9iZSBJbWFnZVJlYWR5ccllPAAAAAZQTFRF/ 
wAAAAAAQaMSAwAAABJJREFUeNpiYBgFo2AwAIAA 
AwACigABtnCV2AAAAABJRU5ErkJggg==); 
=
Use DataURIs to “push” assets 
! 
url( 
! 
! 
! 
! 
! 
! 
data:image/ 
png;base64,iVBORw0KGgoAAAANSUhEUgAAABkA 
AAAZCAMAAADzN3VRAAAAGXRFWHRTb2Z0d2FyZQB 
BZG9iZSBJbWFnZVJlYWR5ccllPAAAAAZQTFRF/ 
wAAAAAAQaMSAwAAABJJREFUeNpiYBgFo2AwAIAA 
AwACigABtnCV2AAAAABJRU5ErkJggg==); 
= 
Larger downloads (needs gzip)! 
Overrides browser priorities
We create CSS and JavaScript bundles 
+ + + + 
= =
We create CSS and JavaScript bundles 
+ + + + 
= = More to download 
and parse
We create CSS and JavaScript bundles 
+ + + + 
= = More to download 
and parse +! x 
! 
Whole bundle is 
invalidated if a 
single file changes
Combine small images into CSS Sprites
Combine small images into CSS Sprites 
To get just one sprite …
Combine small images into CSS Sprites 
To get just one sprite … 
Browser must download and 
decode the whole image
There’s a tension between development and delivery 
https://www.flickr.com/photos/domiriel/7376397968
SPDY & HTTP/2 can reduce that tension 
SPDY 
Multiplexed connection reduces overhead of requests! 
! - less need to merge resources! 
! - better cache hit ratios
HTTP/1.1 - browser sets priorities
SPDY - browser hints priorities 
server can override them
Change doesn’t just create challenges…! 
! 
! 
…it offers new opportunities too
How much of an image do we need to make it usable - 5%?
How much of an image do we need to make it usable - 15%?
How much of an image do we need to make it usable - 25%?
How much of an image do we need to make it usable - 80%?
How much of an image do we need to make it usable - 80%? 
There are some questions over the user 
experience with progressive images
https://www.flickr.com/photos/steveweaver/2915792034 
Browsers pull resources from the server but …
https://www.flickr.com/photos/christian_bachellier/582457911 
What if the server could push them?
Browser Server 
Server! 
builds! 
page 
GET index.html 
<html><head>… 
Loading a web page 
Request other page resources
Browser Server 
Server! 
builds! 
page 
GET index.html 
<html><head>… 
Network! 
Idle 
Request other page resources 
Loading a web page
Browser Server 
Server! 
builds! 
page 
GET index.html 
Push critical resource e .g. CSS 
<html><head>… 
Server Push 
Request other page resources
Browser Server 
Server! 
builds! 
page 
GET index.html 
Push critical resource e .g. CSS 
<html><head>… 
Request other page resources 
Server Push
Browser Server 
Server! 
builds! 
page 
GET index.html 
Push critical resource e .g. CSS 
<html><head>… 
Request other page resources 
Server Push 
Browser can reject push
Other opportunities for server push? 
HTML 
CSS 
DOM 
CSSOM 
Render! 
Tree 
JavaScript Layout Paint
Other opportunities for server push? 
HTML 
CSS 
DOM 
CSSOM 
Render! 
Tree 
Fonts and background 
images discovered 
when render tree builds 
JavaScript Layout Paint
Other opportunities for server push? 
HTML 
CSS 
DOM 
CSSOM 
Render! 
Tree 
Fonts and background 
images discovered 
when render tree builds 
JavaScript Layout Paint 
Could we push them?
There’s a huge amount to cope with 
http://www.flickr.com/photos/atoach/6014917153
and it’s only going to get more complex 
http://www.flickr.com/photos/freshwater2006/693945631
“Situational Performance Optimization, The Next Frontier”! 
! 
Guy Podjarny
Will the complexity be the end of hand crafted optimisations? 
http://www.flickr.com/photos/simeon_barkas/2557059247
Will automation be the only sane way to manage this? 
https://www.flickr.com/photos/skynoir/12342499794
http://www.flickr.com/photos/rkramer62/4028530901 
The way we optimise is going to evolve
Start experimenting, share your experiences 
http://www.flickr.com/photos/giosp/3933753363
Limits to what new protocols or automation can fix 
Requests by Domain Bytes by Domain
Thank You! 
http://www.flickr.com/photos/nzbuu/4093456029 
@andydavies 
andy.davies@nccgroup.com 
http://slideshare.net/andydavies

Más contenido relacionado

La actualidad más candente

Making Mobile Sites Faster
Making Mobile Sites FasterMaking Mobile Sites Faster
Making Mobile Sites FasterAndy Davies
 
Web Page Test - Beyond the Basics
Web Page Test - Beyond the BasicsWeb Page Test - Beyond the Basics
Web Page Test - Beyond the BasicsAndy Davies
 
The Case for HTTP/2 - GreeceJS - June 2016
The Case for HTTP/2 -  GreeceJS - June 2016The Case for HTTP/2 -  GreeceJS - June 2016
The Case for HTTP/2 - GreeceJS - June 2016Andy Davies
 
Sniffing the Mobile Context
Sniffing the Mobile ContextSniffing the Mobile Context
Sniffing the Mobile ContextAndy Davies
 
Are Today’s Good Practices… Tomorrow’s Performance Anti-Patterns?
Are Today’s Good Practices… Tomorrow’s Performance Anti-Patterns?Are Today’s Good Practices… Tomorrow’s Performance Anti-Patterns?
Are Today’s Good Practices… Tomorrow’s Performance Anti-Patterns?Andy Davies
 
Browser Wars Episode 1: The Phantom Menace
Browser Wars Episode 1: The Phantom MenaceBrowser Wars Episode 1: The Phantom Menace
Browser Wars Episode 1: The Phantom MenaceNicholas Zakas
 
How I learned to stop worrying and love the .htaccess file
How I learned to stop worrying and love the .htaccess fileHow I learned to stop worrying and love the .htaccess file
How I learned to stop worrying and love the .htaccess fileRoxana Stingu
 
Speed is Essential for a Great Web Experience
Speed is Essential for a Great Web ExperienceSpeed is Essential for a Great Web Experience
Speed is Essential for a Great Web ExperienceAndy Davies
 
SearchLove San Diego 2018 | Tom Anthony | An Introduction to HTTP/2 & Service...
SearchLove San Diego 2018 | Tom Anthony | An Introduction to HTTP/2 & Service...SearchLove San Diego 2018 | Tom Anthony | An Introduction to HTTP/2 & Service...
SearchLove San Diego 2018 | Tom Anthony | An Introduction to HTTP/2 & Service...Distilled
 
EdgeConf - Page Load Performance Opening Talk
EdgeConf - Page Load Performance Opening TalkEdgeConf - Page Load Performance Opening Talk
EdgeConf - Page Load Performance Opening TalkAndy Davies
 
Mobile Web Speed Bumps
Mobile Web Speed BumpsMobile Web Speed Bumps
Mobile Web Speed BumpsNicholas Zakas
 
Making Mobile Sites Faster
Making Mobile Sites FasterMaking Mobile Sites Faster
Making Mobile Sites FasterAndy Davies
 
Web Performance Workshop - Velocity London 2013
Web Performance Workshop - Velocity London 2013Web Performance Workshop - Velocity London 2013
Web Performance Workshop - Velocity London 2013Andy Davies
 
A Holistic View of Website Performance
A Holistic View of Website PerformanceA Holistic View of Website Performance
A Holistic View of Website PerformanceRene Churchill
 
SearchLove San Diego 2018 | Mat Clayton | Site Speed for Digital Marketers
SearchLove San Diego 2018 | Mat Clayton | Site Speed for Digital MarketersSearchLove San Diego 2018 | Mat Clayton | Site Speed for Digital Marketers
SearchLove San Diego 2018 | Mat Clayton | Site Speed for Digital MarketersDistilled
 
Progressive Enhancement 2.0 (Conference Agnostic)
Progressive Enhancement 2.0 (Conference Agnostic)Progressive Enhancement 2.0 (Conference Agnostic)
Progressive Enhancement 2.0 (Conference Agnostic)Nicholas Zakas
 
Web Performance - A Whistlestop Tour
Web Performance - A Whistlestop TourWeb Performance - A Whistlestop Tour
Web Performance - A Whistlestop TourAndy Davies
 
The Need For Speed
The Need For SpeedThe Need For Speed
The Need For SpeedAndy Davies
 
Word campktm speed-security
Word campktm speed-securityWord campktm speed-security
Word campktm speed-securityDigamber Pradhan
 

La actualidad más candente (20)

Making Mobile Sites Faster
Making Mobile Sites FasterMaking Mobile Sites Faster
Making Mobile Sites Faster
 
Web Page Test - Beyond the Basics
Web Page Test - Beyond the BasicsWeb Page Test - Beyond the Basics
Web Page Test - Beyond the Basics
 
The Case for HTTP/2 - GreeceJS - June 2016
The Case for HTTP/2 -  GreeceJS - June 2016The Case for HTTP/2 -  GreeceJS - June 2016
The Case for HTTP/2 - GreeceJS - June 2016
 
Sniffing the Mobile Context
Sniffing the Mobile ContextSniffing the Mobile Context
Sniffing the Mobile Context
 
Are Today’s Good Practices… Tomorrow’s Performance Anti-Patterns?
Are Today’s Good Practices… Tomorrow’s Performance Anti-Patterns?Are Today’s Good Practices… Tomorrow’s Performance Anti-Patterns?
Are Today’s Good Practices… Tomorrow’s Performance Anti-Patterns?
 
Browser Wars Episode 1: The Phantom Menace
Browser Wars Episode 1: The Phantom MenaceBrowser Wars Episode 1: The Phantom Menace
Browser Wars Episode 1: The Phantom Menace
 
How I learned to stop worrying and love the .htaccess file
How I learned to stop worrying and love the .htaccess fileHow I learned to stop worrying and love the .htaccess file
How I learned to stop worrying and love the .htaccess file
 
Speed is Essential for a Great Web Experience
Speed is Essential for a Great Web ExperienceSpeed is Essential for a Great Web Experience
Speed is Essential for a Great Web Experience
 
SearchLove San Diego 2018 | Tom Anthony | An Introduction to HTTP/2 & Service...
SearchLove San Diego 2018 | Tom Anthony | An Introduction to HTTP/2 & Service...SearchLove San Diego 2018 | Tom Anthony | An Introduction to HTTP/2 & Service...
SearchLove San Diego 2018 | Tom Anthony | An Introduction to HTTP/2 & Service...
 
EdgeConf - Page Load Performance Opening Talk
EdgeConf - Page Load Performance Opening TalkEdgeConf - Page Load Performance Opening Talk
EdgeConf - Page Load Performance Opening Talk
 
Mobile Web Speed Bumps
Mobile Web Speed BumpsMobile Web Speed Bumps
Mobile Web Speed Bumps
 
Making Mobile Sites Faster
Making Mobile Sites FasterMaking Mobile Sites Faster
Making Mobile Sites Faster
 
Web Performance Workshop - Velocity London 2013
Web Performance Workshop - Velocity London 2013Web Performance Workshop - Velocity London 2013
Web Performance Workshop - Velocity London 2013
 
A Holistic View of Website Performance
A Holistic View of Website PerformanceA Holistic View of Website Performance
A Holistic View of Website Performance
 
SearchLove San Diego 2018 | Mat Clayton | Site Speed for Digital Marketers
SearchLove San Diego 2018 | Mat Clayton | Site Speed for Digital MarketersSearchLove San Diego 2018 | Mat Clayton | Site Speed for Digital Marketers
SearchLove San Diego 2018 | Mat Clayton | Site Speed for Digital Marketers
 
Progressive Enhancement 2.0 (Conference Agnostic)
Progressive Enhancement 2.0 (Conference Agnostic)Progressive Enhancement 2.0 (Conference Agnostic)
Progressive Enhancement 2.0 (Conference Agnostic)
 
What is HTML 5?
What is HTML 5?What is HTML 5?
What is HTML 5?
 
Web Performance - A Whistlestop Tour
Web Performance - A Whistlestop TourWeb Performance - A Whistlestop Tour
Web Performance - A Whistlestop Tour
 
The Need For Speed
The Need For SpeedThe Need For Speed
The Need For Speed
 
Word campktm speed-security
Word campktm speed-securityWord campktm speed-security
Word campktm speed-security
 

Similar a Are Today’s Good Practices… Tomorrow’s Performance Anti-Patterns?

Faster Frontends
Faster FrontendsFaster Frontends
Faster FrontendsAndy Davies
 
The case for HTTP/2
The case for HTTP/2The case for HTTP/2
The case for HTTP/2GreeceJS
 
Build Better Responsive websites. Hrvoje Jurišić
Build Better Responsive websites. Hrvoje JurišićBuild Better Responsive websites. Hrvoje Jurišić
Build Better Responsive websites. Hrvoje JurišićMeetMagentoNY2014
 
Progressive downloads and rendering (Stoyan Stefanov)
Progressive downloads and rendering (Stoyan Stefanov)Progressive downloads and rendering (Stoyan Stefanov)
Progressive downloads and rendering (Stoyan Stefanov)Ontico
 
Progressive Enhancement 2.0 (jQuery Conference SF Bay Area 2011)
Progressive Enhancement 2.0 (jQuery Conference SF Bay Area 2011)Progressive Enhancement 2.0 (jQuery Conference SF Bay Area 2011)
Progressive Enhancement 2.0 (jQuery Conference SF Bay Area 2011)Nicholas Zakas
 
10 Tips to make your Website lightning-fast - SMX Stockholm 2012
10 Tips to make your Website lightning-fast - SMX Stockholm 201210 Tips to make your Website lightning-fast - SMX Stockholm 2012
10 Tips to make your Website lightning-fast - SMX Stockholm 2012Bastian Grimm
 
Web Components: The Future of Web Development is Here
Web Components: The Future of Web Development is HereWeb Components: The Future of Web Development is Here
Web Components: The Future of Web Development is HereJohn Riviello
 
Http/2 - What's it all about?
Http/2  - What's it all about?Http/2  - What's it all about?
Http/2 - What's it all about?Andy Davies
 
Progressive Downloads and Rendering
Progressive Downloads and RenderingProgressive Downloads and Rendering
Progressive Downloads and RenderingStoyan Stefanov
 
Web Directions South - Even Faster Web Sites
Web Directions South - Even Faster Web SitesWeb Directions South - Even Faster Web Sites
Web Directions South - Even Faster Web SitesSteve Souders
 
It's Business Time: Givin' User Experience Love with CSS3
It's Business Time: Givin' User Experience Love with CSS3It's Business Time: Givin' User Experience Love with CSS3
It's Business Time: Givin' User Experience Love with CSS3Denise Jacobs
 
EscConf - Deep Dive Frontend Optimization
EscConf - Deep Dive Frontend OptimizationEscConf - Deep Dive Frontend Optimization
EscConf - Deep Dive Frontend OptimizationJonathan Klein
 
Mobile First Responsive Design
Mobile First Responsive DesignMobile First Responsive Design
Mobile First Responsive DesignJason Grigsby
 
Scott Jehl - Delivering Responsibly - beyond tellerrand Düsseldorf 2015
Scott Jehl - Delivering Responsibly - beyond tellerrand Düsseldorf 2015Scott Jehl - Delivering Responsibly - beyond tellerrand Düsseldorf 2015
Scott Jehl - Delivering Responsibly - beyond tellerrand Düsseldorf 2015beyond tellerrand
 
CSS3: Are you experienced?
CSS3: Are you experienced?CSS3: Are you experienced?
CSS3: Are you experienced?Denise Jacobs
 
DrupalCampLA 2011 - Drupal frontend-optimizing
DrupalCampLA 2011 - Drupal frontend-optimizingDrupalCampLA 2011 - Drupal frontend-optimizing
DrupalCampLA 2011 - Drupal frontend-optimizingAshok Modi
 
Performance and UX
Performance and UXPerformance and UX
Performance and UXPeter Rozek
 

Similar a Are Today’s Good Practices… Tomorrow’s Performance Anti-Patterns? (20)

Faster Frontends
Faster FrontendsFaster Frontends
Faster Frontends
 
The case for HTTP/2
The case for HTTP/2The case for HTTP/2
The case for HTTP/2
 
Build Better Responsive websites. Hrvoje Jurišić
Build Better Responsive websites. Hrvoje JurišićBuild Better Responsive websites. Hrvoje Jurišić
Build Better Responsive websites. Hrvoje Jurišić
 
Progressive downloads and rendering (Stoyan Stefanov)
Progressive downloads and rendering (Stoyan Stefanov)Progressive downloads and rendering (Stoyan Stefanov)
Progressive downloads and rendering (Stoyan Stefanov)
 
Progressive Enhancement 2.0 (jQuery Conference SF Bay Area 2011)
Progressive Enhancement 2.0 (jQuery Conference SF Bay Area 2011)Progressive Enhancement 2.0 (jQuery Conference SF Bay Area 2011)
Progressive Enhancement 2.0 (jQuery Conference SF Bay Area 2011)
 
10 Tips to make your Website lightning-fast - SMX Stockholm 2012
10 Tips to make your Website lightning-fast - SMX Stockholm 201210 Tips to make your Website lightning-fast - SMX Stockholm 2012
10 Tips to make your Website lightning-fast - SMX Stockholm 2012
 
Web Components: The Future of Web Development is Here
Web Components: The Future of Web Development is HereWeb Components: The Future of Web Development is Here
Web Components: The Future of Web Development is Here
 
Http/2 - What's it all about?
Http/2  - What's it all about?Http/2  - What's it all about?
Http/2 - What's it all about?
 
Progressive Downloads and Rendering
Progressive Downloads and RenderingProgressive Downloads and Rendering
Progressive Downloads and Rendering
 
Web Directions South - Even Faster Web Sites
Web Directions South - Even Faster Web SitesWeb Directions South - Even Faster Web Sites
Web Directions South - Even Faster Web Sites
 
performance.ppt
performance.pptperformance.ppt
performance.ppt
 
It's Business Time: Givin' User Experience Love with CSS3
It's Business Time: Givin' User Experience Love with CSS3It's Business Time: Givin' User Experience Love with CSS3
It's Business Time: Givin' User Experience Love with CSS3
 
Hacking Web Performance
Hacking Web PerformanceHacking Web Performance
Hacking Web Performance
 
EscConf - Deep Dive Frontend Optimization
EscConf - Deep Dive Frontend OptimizationEscConf - Deep Dive Frontend Optimization
EscConf - Deep Dive Frontend Optimization
 
Mobile First Responsive Design
Mobile First Responsive DesignMobile First Responsive Design
Mobile First Responsive Design
 
Presentation Tier optimizations
Presentation Tier optimizationsPresentation Tier optimizations
Presentation Tier optimizations
 
Scott Jehl - Delivering Responsibly - beyond tellerrand Düsseldorf 2015
Scott Jehl - Delivering Responsibly - beyond tellerrand Düsseldorf 2015Scott Jehl - Delivering Responsibly - beyond tellerrand Düsseldorf 2015
Scott Jehl - Delivering Responsibly - beyond tellerrand Düsseldorf 2015
 
CSS3: Are you experienced?
CSS3: Are you experienced?CSS3: Are you experienced?
CSS3: Are you experienced?
 
DrupalCampLA 2011 - Drupal frontend-optimizing
DrupalCampLA 2011 - Drupal frontend-optimizingDrupalCampLA 2011 - Drupal frontend-optimizing
DrupalCampLA 2011 - Drupal frontend-optimizing
 
Performance and UX
Performance and UXPerformance and UX
Performance and UX
 

Más de Andy Davies

Fast Fashion… How Missguided revolutionised their approach to site performanc...
Fast Fashion… How Missguided revolutionised their approach to site performanc...Fast Fashion… How Missguided revolutionised their approach to site performanc...
Fast Fashion… How Missguided revolutionised their approach to site performanc...Andy Davies
 
Fast Fashion… How Missguided revolutionised their approach to site performanc...
Fast Fashion… How Missguided revolutionised their approach to site performanc...Fast Fashion… How Missguided revolutionised their approach to site performanc...
Fast Fashion… How Missguided revolutionised their approach to site performanc...Andy Davies
 
AB Testing, Ads and other 3rd party tags - London WebPerf - March 2018
AB Testing, Ads and other 3rd party tags - London WebPerf - March 2018AB Testing, Ads and other 3rd party tags - London WebPerf - March 2018
AB Testing, Ads and other 3rd party tags - London WebPerf - March 2018Andy Davies
 
AB Testing, Ads and other 3rd party tags - SmashingConf London - 2018
AB Testing, Ads and other 3rd party tags - SmashingConf London - 2018AB Testing, Ads and other 3rd party tags - SmashingConf London - 2018
AB Testing, Ads and other 3rd party tags - SmashingConf London - 2018Andy Davies
 
Inspecting iOS App Traffic with JavaScript - JSOxford - Jan 2018
Inspecting iOS App Traffic with JavaScript - JSOxford - Jan 2018Inspecting iOS App Traffic with JavaScript - JSOxford - Jan 2018
Inspecting iOS App Traffic with JavaScript - JSOxford - Jan 2018Andy Davies
 
Selling Performance - Bristol WebPerf Meetup 2017-07-20
Selling Performance - Bristol WebPerf Meetup 2017-07-20Selling Performance - Bristol WebPerf Meetup 2017-07-20
Selling Performance - Bristol WebPerf Meetup 2017-07-20Andy Davies
 
Speed: The 'Forgotten' Conversion Factor
Speed: The 'Forgotten' Conversion FactorSpeed: The 'Forgotten' Conversion Factor
Speed: The 'Forgotten' Conversion FactorAndy Davies
 
Building an Appier Web - London Web Standards - Nov 2016
Building an Appier Web -  London Web Standards - Nov 2016Building an Appier Web -  London Web Standards - Nov 2016
Building an Appier Web - London Web Standards - Nov 2016Andy Davies
 
Building an Appier Web - Velocity Amsterdam 2016
Building an Appier Web - Velocity Amsterdam 2016Building an Appier Web - Velocity Amsterdam 2016
Building an Appier Web - Velocity Amsterdam 2016Andy Davies
 
Building an Appier Web - May 2016
Building an Appier Web - May 2016Building an Appier Web - May 2016
Building an Appier Web - May 2016Andy Davies
 
The Fast, The Slow and The Unconverted - Emerce Conversion 2016
The Fast, The Slow and The Unconverted -  Emerce Conversion 2016The Fast, The Slow and The Unconverted -  Emerce Conversion 2016
The Fast, The Slow and The Unconverted - Emerce Conversion 2016Andy Davies
 
Making Mobile Sites Faster
Making Mobile Sites FasterMaking Mobile Sites Faster
Making Mobile Sites FasterAndy Davies
 
Speed matters, So why is your site so slow?
Speed matters, So why is your site so slow?Speed matters, So why is your site so slow?
Speed matters, So why is your site so slow?Andy Davies
 
Are Today’s Good Practices... Tomorrow’s Performance Anti-Patterns?
Are Today’s Good Practices... Tomorrow’s Performance Anti-Patterns?Are Today’s Good Practices... Tomorrow’s Performance Anti-Patterns?
Are Today’s Good Practices... Tomorrow’s Performance Anti-Patterns?Andy Davies
 
Are Today's Good Practices… Tomorrow's Performance Anti-Patterns
Are Today's Good Practices… Tomorrow's Performance Anti-PatternsAre Today's Good Practices… Tomorrow's Performance Anti-Patterns
Are Today's Good Practices… Tomorrow's Performance Anti-PatternsAndy Davies
 

Más de Andy Davies (16)

Fast Fashion… How Missguided revolutionised their approach to site performanc...
Fast Fashion… How Missguided revolutionised their approach to site performanc...Fast Fashion… How Missguided revolutionised their approach to site performanc...
Fast Fashion… How Missguided revolutionised their approach to site performanc...
 
Fast Fashion… How Missguided revolutionised their approach to site performanc...
Fast Fashion… How Missguided revolutionised their approach to site performanc...Fast Fashion… How Missguided revolutionised their approach to site performanc...
Fast Fashion… How Missguided revolutionised their approach to site performanc...
 
AB Testing, Ads and other 3rd party tags - London WebPerf - March 2018
AB Testing, Ads and other 3rd party tags - London WebPerf - March 2018AB Testing, Ads and other 3rd party tags - London WebPerf - March 2018
AB Testing, Ads and other 3rd party tags - London WebPerf - March 2018
 
AB Testing, Ads and other 3rd party tags - SmashingConf London - 2018
AB Testing, Ads and other 3rd party tags - SmashingConf London - 2018AB Testing, Ads and other 3rd party tags - SmashingConf London - 2018
AB Testing, Ads and other 3rd party tags - SmashingConf London - 2018
 
Inspecting iOS App Traffic with JavaScript - JSOxford - Jan 2018
Inspecting iOS App Traffic with JavaScript - JSOxford - Jan 2018Inspecting iOS App Traffic with JavaScript - JSOxford - Jan 2018
Inspecting iOS App Traffic with JavaScript - JSOxford - Jan 2018
 
Selling Performance - Bristol WebPerf Meetup 2017-07-20
Selling Performance - Bristol WebPerf Meetup 2017-07-20Selling Performance - Bristol WebPerf Meetup 2017-07-20
Selling Performance - Bristol WebPerf Meetup 2017-07-20
 
Speed: The 'Forgotten' Conversion Factor
Speed: The 'Forgotten' Conversion FactorSpeed: The 'Forgotten' Conversion Factor
Speed: The 'Forgotten' Conversion Factor
 
Building an Appier Web - London Web Standards - Nov 2016
Building an Appier Web -  London Web Standards - Nov 2016Building an Appier Web -  London Web Standards - Nov 2016
Building an Appier Web - London Web Standards - Nov 2016
 
Building an Appier Web - Velocity Amsterdam 2016
Building an Appier Web - Velocity Amsterdam 2016Building an Appier Web - Velocity Amsterdam 2016
Building an Appier Web - Velocity Amsterdam 2016
 
Building an Appier Web - May 2016
Building an Appier Web - May 2016Building an Appier Web - May 2016
Building an Appier Web - May 2016
 
The Fast, The Slow and The Unconverted - Emerce Conversion 2016
The Fast, The Slow and The Unconverted -  Emerce Conversion 2016The Fast, The Slow and The Unconverted -  Emerce Conversion 2016
The Fast, The Slow and The Unconverted - Emerce Conversion 2016
 
Making Mobile Sites Faster
Making Mobile Sites FasterMaking Mobile Sites Faster
Making Mobile Sites Faster
 
Speed matters, So why is your site so slow?
Speed matters, So why is your site so slow?Speed matters, So why is your site so slow?
Speed matters, So why is your site so slow?
 
HTTP2 is Here!
HTTP2 is Here!HTTP2 is Here!
HTTP2 is Here!
 
Are Today’s Good Practices... Tomorrow’s Performance Anti-Patterns?
Are Today’s Good Practices... Tomorrow’s Performance Anti-Patterns?Are Today’s Good Practices... Tomorrow’s Performance Anti-Patterns?
Are Today’s Good Practices... Tomorrow’s Performance Anti-Patterns?
 
Are Today's Good Practices… Tomorrow's Performance Anti-Patterns
Are Today's Good Practices… Tomorrow's Performance Anti-PatternsAre Today's Good Practices… Tomorrow's Performance Anti-Patterns
Are Today's Good Practices… Tomorrow's Performance Anti-Patterns
 

Último

Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clashcharlottematthew16
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Patryk Bandurski
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationSafe Software
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Mark Simos
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsMemoori
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek SchlawackFwdays
 
Training state-of-the-art general text embedding
Training state-of-the-art general text embeddingTraining state-of-the-art general text embedding
Training state-of-the-art general text embeddingZilliz
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):comworks
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machinePadma Pradeep
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsMiki Katsuragi
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piececharlottematthew16
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brandgvaughan
 
Vector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector DatabasesVector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector DatabasesZilliz
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfAddepto
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsRizwan Syed
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr LapshynFwdays
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Enterprise Knowledge
 

Último (20)

Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clash
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial Buildings
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
 
Training state-of-the-art general text embedding
Training state-of-the-art general text embeddingTraining state-of-the-art general text embedding
Training state-of-the-art general text embedding
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machine
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering Tips
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piece
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brand
 
Vector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector DatabasesVector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector Databases
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdf
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024
 

Are Today’s Good Practices… Tomorrow’s Performance Anti-Patterns?

  • 1. http://www.flickr.com/photos/nzbuu/4093456029 Are Today’s Good Practices… Tomorrow’s Performance Anti-Patterns? @andydavies #Akamai Edge, Oct 2014
  • 2.
  • 5. One Christmas… http://www.flickr.com/photos/willypayne/3116395089 What if …! ! … dataURIs are an anti-pattern?
  • 6. dataURIs are a technique to reduce number of HTTP requests /images/redsquare.png .selector { background-image: url(/images/redsquare.png); }
  • 7. Encode image as base64 string encode iVBORw0KGgoAAAANSUhEUgAAABk AAAAZCAMAAADzN3VRAAAAGXRFWH RTb2Z0d2FyZQBBZG9iZSBJbWFnZ VJlYWR5ccllPAAAAAZQTFRF/ wAAAAAAQaMSAwAAABJJREFUeNpi YBgFo2AwAIAAAwACigABtnCV2AA AAABJRU5ErkJggg== /images/redsquare.png base64 string
  • 8. Replace image path with dataURI ! .selector { background-image: url( ! ! ! ! ! } data:image/ png;base64,iVBORw0KGgoAAAANSUhEUgAAABkA AAAZCAMAAADzN3VRAAAAGXRFWHRTb2Z0d2FyZQB BZG9iZSBJbWFnZVJlYWR5ccllPAAAAAZQTFRF/ wAAAAAAQaMSAwAAABJJREFUeNpiYBgFo2AwAIAA AwACigABtnCV2AAAAABJRU5ErkJggg==); dataURIs can also be used with other non-image elements too
  • 9. Reduces number of requests but it’s a tradeoff Makes a blocking resource (CSS) larger by including non-blocking resources! • Browser can’t start rendering page until CSS has downloaded *! • Images don’t block! ! Do they have the same caching lifetime?! Overrides browsers pre-loader heuristics * Some browsers defer download of CSS when media query doesn’t match
  • 10. Test the theory http://www.flickr.com/photos/marc-flores/8367323660
  • 11. 1.Take 50 icons! 2.Create 50 stylesheets, each with one more dataURI than previous! 3.Create matching HTML file for each stylesheet! 4.Test them all! (using WebPagetest)
  • 12. Larger CSS download = longer time to RenderStart 1000 ms) 875 (TTFB - 750 RenderStart 625 500 1 3 5 7 9 11 13 15 17 19 21 23 25 27 29 31 33 35 37 39 41 43 45 47 49 Number of Sprites
  • 13. Larger CSS download = longer time to RenderStart 1000 ms) 875 (TTFB - 750 RenderStart 625 500 1 3 5 7 9 11 13 15 17 19 21 23 25 27 29 31 33 35 37 39 41 43 45 47 49 Number of Sprites
  • 14. This started me thinking! www.flickr.com/photos/irishwildcat/3020466221
  • 15. We have our rules… http://www.flickr.com/photos/sowrey/2441134911
  • 16. and we love recipes… http://www.flickr.com/photos/mrsmagic/2247364228
  • 17. But, what happens when things change?
  • 18. Browsers already use the network differently
  • 19. Download order != Document order https://www.flickr.com/photos/add1sun/4993432274
  • 20.
  • 21.
  • 22. Prioritisation sometimes has unexpected consequences Major UK retailer’s site in Chrome
  • 23. Prioritisation sometimes has unexpected consequences These JS resources are at the foot of the body! (perhaps they should merge them into fewer resources but…)
  • 24. Prioritisation sometimes has unexpected consequences The hero image is delayed as it waits for the JS to downloaded
  • 25. New network protocols are coming here http://www.flickr.com/photos/jonlachance/3427660741
  • 26. They use TCP connections differently HTTP 1.1 SPDY
  • 27. New standards present both opportunities and challenges
  • 28. So how might this change what we do today?
  • 29. How much do we rely on inline JavaScript? www.flickr.com/photos/jfraissi/6352877711
  • 30. 82% of visitors support async attribute ! <script async src="script.js"></script> http://caniuse.com/script-async
  • 31. 82% of visitors support async attribute ! <script async src="script.js"></script> http://caniuse.com/script-async Tells browsers they don’t need pause DOM construction while the JavaScript downloads and executes
  • 32. Yet, this is how we typically load scripts asynchronously <script type="text/javascript"> (function() { var js = document.createElement('script'); js.async = true; js.src = 'script.js'; var e = document.getElementsByTagName('script')[0]; e.parentNode.insertBefore(js, first); })(); </script>
  • 33. Yet, this is how we typically load scripts asynchronously <script type="text/javascript"> (function() { Browser won’t discover script until outer script inserts it into DOM var js = document.createElement('script'); js.async = true; js.src = 'script.js'; var e = document.getElementsByTagName('script')[0]; e.parentNode.insertBefore(js, first); })(); </script>
  • 34. XSS
  • 35. Content-Security-Policy “Content Security Policy, a mechanism web applications can use to mitigate a broad class of content injection vulnerabilities, such as cross-site scripting (XSS)” http://www.w3.org/TR/CSP/
  • 36. Only allow scripts to be executed if they come from a designated host, disables inline scripts by default. Content-Security-Policy: script-src http://www.site.com Can re-enable inline scripts, but increases XSS risk Content-Security-Policy script-src 'self' Doesn’t just apply to scripts, can be used with CSS, fonts, images etc.
  • 37. What other performance enhancements do we rely on inline JS for? The Guardian prioritise their content! ! Divide page load into:! - Content! - Enhancements! - Leftovers ! ! Some sites rely on scroll handlers for lazyloading
  • 38.
  • 39. W3C Resource Priorities - adds lazyload attribute (also look at Ilya Grigorik’s proposal for Resource Hints)
  • 40. So what about the network? http://www.flickr.com/photos/uwwresnet/5881727219
  • 42. We’ve been hacking around the gaps https://www.flickr.com/photos/rocketnumber9/13695281
  • 43. Browsers added support for more parallel connections Old browsers - 2 parallel connections Today’s browsers - 4 plus connections
  • 44. We split resources across domains www.bbc.co.uk! static.bbci.co.uk! news.bbcimg.co.uk! node1.bbcimg.co.uk
  • 45. Use DataURIs to “push” assets ! url( ! ! ! ! ! ! data:image/ png;base64,iVBORw0KGgoAAAANSUhEUgAAABkA AAAZCAMAAADzN3VRAAAAGXRFWHRTb2Z0d2FyZQB BZG9iZSBJbWFnZVJlYWR5ccllPAAAAAZQTFRF/ wAAAAAAQaMSAwAAABJJREFUeNpiYBgFo2AwAIAA AwACigABtnCV2AAAAABJRU5ErkJggg==); =
  • 46. Use DataURIs to “push” assets ! url( ! ! ! ! ! ! data:image/ png;base64,iVBORw0KGgoAAAANSUhEUgAAABkA AAAZCAMAAADzN3VRAAAAGXRFWHRTb2Z0d2FyZQB BZG9iZSBJbWFnZVJlYWR5ccllPAAAAAZQTFRF/ wAAAAAAQaMSAwAAABJJREFUeNpiYBgFo2AwAIAA AwACigABtnCV2AAAAABJRU5ErkJggg==); = Larger downloads (needs gzip)! Overrides browser priorities
  • 47. We create CSS and JavaScript bundles + + + + = =
  • 48. We create CSS and JavaScript bundles + + + + = = More to download and parse
  • 49. We create CSS and JavaScript bundles + + + + = = More to download and parse +! x ! Whole bundle is invalidated if a single file changes
  • 50. Combine small images into CSS Sprites
  • 51. Combine small images into CSS Sprites To get just one sprite …
  • 52. Combine small images into CSS Sprites To get just one sprite … Browser must download and decode the whole image
  • 53. There’s a tension between development and delivery https://www.flickr.com/photos/domiriel/7376397968
  • 54. SPDY & HTTP/2 can reduce that tension SPDY Multiplexed connection reduces overhead of requests! ! - less need to merge resources! ! - better cache hit ratios
  • 55. HTTP/1.1 - browser sets priorities
  • 56. SPDY - browser hints priorities server can override them
  • 57. Change doesn’t just create challenges…! ! ! …it offers new opportunities too
  • 58. How much of an image do we need to make it usable - 5%?
  • 59. How much of an image do we need to make it usable - 15%?
  • 60. How much of an image do we need to make it usable - 25%?
  • 61. How much of an image do we need to make it usable - 80%?
  • 62. How much of an image do we need to make it usable - 80%? There are some questions over the user experience with progressive images
  • 65. Browser Server Server! builds! page GET index.html <html><head>… Loading a web page Request other page resources
  • 66. Browser Server Server! builds! page GET index.html <html><head>… Network! Idle Request other page resources Loading a web page
  • 67. Browser Server Server! builds! page GET index.html Push critical resource e .g. CSS <html><head>… Server Push Request other page resources
  • 68. Browser Server Server! builds! page GET index.html Push critical resource e .g. CSS <html><head>… Request other page resources Server Push
  • 69. Browser Server Server! builds! page GET index.html Push critical resource e .g. CSS <html><head>… Request other page resources Server Push Browser can reject push
  • 70. Other opportunities for server push? HTML CSS DOM CSSOM Render! Tree JavaScript Layout Paint
  • 71. Other opportunities for server push? HTML CSS DOM CSSOM Render! Tree Fonts and background images discovered when render tree builds JavaScript Layout Paint
  • 72. Other opportunities for server push? HTML CSS DOM CSSOM Render! Tree Fonts and background images discovered when render tree builds JavaScript Layout Paint Could we push them?
  • 73. There’s a huge amount to cope with http://www.flickr.com/photos/atoach/6014917153
  • 74. and it’s only going to get more complex http://www.flickr.com/photos/freshwater2006/693945631
  • 75. “Situational Performance Optimization, The Next Frontier”! ! Guy Podjarny
  • 76. Will the complexity be the end of hand crafted optimisations? http://www.flickr.com/photos/simeon_barkas/2557059247
  • 77. Will automation be the only sane way to manage this? https://www.flickr.com/photos/skynoir/12342499794
  • 79. Start experimenting, share your experiences http://www.flickr.com/photos/giosp/3933753363
  • 80. Limits to what new protocols or automation can fix Requests by Domain Bytes by Domain
  • 81. Thank You! http://www.flickr.com/photos/nzbuu/4093456029 @andydavies andy.davies@nccgroup.com http://slideshare.net/andydavies