Tim Kadlec @tkadlec 2012 Web Peformance Summit 8/29/2012
Responsive
Responsive Design
Building sites that are flexible and fast
Velocity NY | October 14, 2013
Slide 2
Slide 2 text
— Ethan Marcotte
Now more than ever, we’re designing work meant to be
viewed along a gradient of different experiences.
Responsive web design offers us a way forward, finally
allowing us to “design for the ebb and flow of things.
http://alistapart.com/article/responsive-web-design
Slide 3
Slide 3 text
No content
Slide 4
Slide 4 text
— John Allsopp
The control which designers know in the print medium, and
often desire in the web medium, is simply a function of the
limitation of the printed page. We should embrace the fact
that the web doesn’t have the same constraints, and design
for this flexibility.
http://alistapart.com/article/dao
Slide 5
Slide 5 text
More than layout
Slide 6
Slide 6 text
— Ethan Marcotte
Now more than ever, we’re designing work meant to be
viewed along a gradient of different experiences.
Responsive web design offers us a way forward, finally
allowing us to “design for the ebb and flow of things.
gradient of different experiences
http://alistapart.com/article/responsive-web-design
Slide 7
Slide 7 text
— Ethan Marcotte
Now more than ever, we’re designing work meant to be
viewed along a gradient of different experiences.
Responsive web design offers us a way forward, finally
allowing us to “design for the ebb and flow of things.
gradient of different experiences
http://alistapart.com/article/responsive-web-design
Slide 8
Slide 8 text
— Stephanie Rieger
Shoot me now…responsive design has seemingly become
confused with an opportunity to reduce performance rather
than improve it.
https://twitter.com/stephanierieger/status/245240465572642816
71%
as quickly or faster
http://www.gomez.com/resources/whitepapers/survey-report-what-users-want-from-mobile
Slide 16
Slide 16 text
Performance is a fundamental
component of the user experience.
Slide 17
Slide 17 text
RWD is bad for performance!!!
Slide 18
Slide 18 text
No content
Slide 19
Slide 19 text
Blame the implementation, not the
technique.
http://timkadlec.com/2012/10/blame-the-implementation-not-the-technique/
Slide 20
Slide 20 text
No content
Slide 21
Slide 21 text
March 2012: 829kb
http://www.stevesouders.com/blog/2013/04/05/page-weight-grows-24-year-over-year-not-44/
Slide 22
Slide 22 text
March 2012: 829kb
March 2013: 1031kb
http://www.stevesouders.com/blog/2013/04/05/page-weight-grows-24-year-over-year-not-44/
Slide 23
Slide 23 text
Performance needs to matter because it matters to users
A culture of performance
Slide 24
Slide 24 text
— A friend
I doubt anyone really wants to release a site that doesn't
perform well, it's just a product of not being afforded the
luxury of time and top-down pressure.
Slide 25
Slide 25 text
Set a performance budget
Slide 26
Slide 26 text
Must be usable in <= 10s
65kB - 100kB
Slide 27
Slide 27 text
1. Optimize
Slide 28
Slide 28 text
1. Optimize
2. Remove
Slide 29
Slide 29 text
1. Optimize
2. Remove
3. Don’t Add
Slide 30
Slide 30 text
Become a performance masochist
Embrace the pain
Slide 31
Slide 31 text
Get real, early
Slide 32
Slide 32 text
— Brad Frost
You can’t mock-up performance in Photoshop.
Slide 33
Slide 33 text
— Brad Frost
You can’t mock-up performance in Photoshop.
Slide 34
Slide 34 text
No content
Slide 35
Slide 35 text
Or: Why I cry myself to sleep at night
Responsive Images
Slide 36
Slide 36 text
No content
Slide 37
Slide 37 text
61%
Slide 38
Slide 38 text
No content
Slide 39
Slide 39 text
66%
Slide 40
Slide 40 text
Trim the fat
Compress any and all images
Slide 41
Slide 41 text
No content
Slide 42
Slide 42 text
23 images = 633.0 KB
Before Compression
Slide 43
Slide 43 text
23 images = 597.4 KB
After Compression
Slide 44
Slide 44 text
35.6 KB
After Compression
Slide 45
Slide 45 text
11 CSS background images = 525.9 KB
Before Compression
Slide 46
Slide 46 text
11 CSS background images = 317.1 KB
After Compression
Slide 47
Slide 47 text
208.8KB
After Compression
Slide 48
Slide 48 text
244.4 KB
After Compression
Slide 49
Slide 49 text
Show Not, Waste Not
Don’t download things you don’t need
Slide 50
Slide 50 text
display:none is useless
Slide 51
Slide 51 text
@media all and (max-width: 600px) {
#test1 { display:none; }
}
Slide 52
Slide 52 text
Everybody loads it anyway
Slide 53
Slide 53 text
No content
Slide 54
Slide 54 text
No content
Slide 55
Slide 55 text
Slide 56
Slide 56 text
Slide 57
Slide 57 text
Slide 58
Slide 58 text
Slide 59
Slide 59 text
The preloader
Slide 60
Slide 60 text
Decorative vs. content
Slide 61
Slide 61 text
Appropriate images
Make sure things are the right size and resolution
Slide 62
Slide 62 text
72%
Slide 63
Slide 63 text
255 values for red
255 values for green
255 values for blue
255 values for alpha
var toShow = document.querySelectorAll('[data-lazy-content=' +
item.getAttribute('[data-lazy-reveal]') + ']';
for (var j = toShow.length - 1; j >= 0; j--) {
! var children = toShow[j].childNodes;
! for (var k = children.length - 1; k >= 0; k--) {
! ! var child = children[k];
! ! if (child.nodeType === 8) {
! ! ! //it's a comment
! ! ! toShow[j].innerHTML = child.nodeValue;
! ! ! break;
! ! }
! }
}
Slide 109
Slide 109 text
What about CSS?
Slide 110
Slide 110 text
Embedded
a {
! text-decoration: none;
}
@media screen and (min-width: 1300px) {
! a {
! ! text-decoration: underline;
! }
}
Slide 111
Slide 111 text
External
Slide 112
Slide 112 text
Embedded External
One HTTP request Many HTTP requests
Slide 113
Slide 113 text
Embedded External
One HTTP request Many HTTP requests
Large file could be hard to maintain Organization can be easier
Slide 114
Slide 114 text
Embedded External
One HTTP request Many HTTP requests
Large file could be hard to maintain Organization can be easier
Extra weight, regardless of if needed Smaller CSS for device not supporting media queries
Slide 115
Slide 115 text
Embedded External
One HTTP request Many HTTP requests
Large file could be hard to maintain Organization can be easier
Extra weight, regardless of if needed Smaller CSS for device not supporting media queries
All styles downloaded All styles downloaded (if media queries supported)
Internet Explorer 10
Internet Explorer 9
Internet Explorer 8
Firefox 20
Opera 12.15
Android 4.2.1 Opera Mobile
Nooooo!
Slide 121
Slide 121 text
Embedded External
One HTTP request Many HTTP requests
Large file could be hard to maintain Organization can be easier
Extra weight, regardless of if needed Smaller CSS for device not supporting media queries
All styles downloaded All styles downloaded (if media queries supported)
Everything is in the critical path Browsers can optimize for the critical path
Slide 122
Slide 122 text
Go vanilla
Slide 123
Slide 123 text
https://twitter.com/ppk/status/249100988693241856
Slide 124
Slide 124 text
https://twitter.com/ppk/status/249100988693241856
Slide 125
Slide 125 text
jQuery = 200-300ms
based on 1.8.0
http://jsperf.com/zepto-jq-eval
Slide 126
Slide 126 text
Up to 8s!
Slide 127
Slide 127 text
Custom jQuery builds
Slide 128
Slide 128 text
Everything has
a trade-off
Slide 129
Slide 129 text
No content
Slide 130
Slide 130 text
What value does this provide?
Slide 131
Slide 131 text
Don’t worry about JS library size?
Just include one less image?
Slide 132
Slide 132 text
Worry about JS library size and
include one less image.
Slide 133
Slide 133 text
Smart defaults
Slide 134
Slide 134 text
RESS
Slide 135
Slide 135 text
If you only knew the power of the Dark Side!
RESS
Slide 136
Slide 136 text
This @#$% ain’t easy
Slide 137
Slide 137 text
UA detection
is evil!
Slide 138
Slide 138 text
Browsers are like
fishermen
Slide 139
Slide 139 text
No content
Slide 140
Slide 140 text
No content
Slide 141
Slide 141 text
No content
Slide 142
Slide 142 text
Blame the implementation,
not the technique.
Slide 143
Slide 143 text
No content
Slide 144
Slide 144 text
82% of Alexa top 100 sites use
some form of server-side
detection
http://mobiforge.com/designing/blog/server-side-device-detection-used-82-alexa-top-100-sites