Slides from my talk at ReDevelop 2015
Covers business case for web performance, along with the fundamentals of how latency and the critical rendering path affect page load performance
Andy DaviesIndependent Web Performance Consultant at Asteno
4. The Web is Too Slow
http://www.flickr.com/photos/the_justified_sinner/3507390621
6. (it’s just) Too many sites are too slow
http://www.flickr.com/photos/the_justified_sinner/3507390621
7. and it’s getting worse!
Only 12% of the top 100 (US) retail sites rendered
feature content in less than 3 seconds. !
!
Year-on-year the median page has slowed down
by 23%
Tammy Everts - Radware State of the Union Fall 2014
8. “We’re not being deliberate about performance”!
Tim Kadlec
https://www.flickr.com/photos/lukew/7382528728
9. But only if we build it that way…
http://3.bp.blogspot.com/-0RqujOyE1ro/Up9HF7bPxbI/AAAAAAAAAbM/Ijudm6uq-dg/s1600/This+is+for+Everyone.jpg
10. Reader panel (3,000 people) rated speed (fast page
load time) as their second most important driver!
!
Speed had the highest percentage of people saying it
was VERY important to them
13. Improved load time from 1.2s to 0.5s!
!
+28% page views / session!
+21% time on site / visit!
+20% conversion rate
http://blog.quanta-computing.com/etam-earns-20-of-conversion-by-optimising-its-online-store/
14. We’re more tolerant as we get further into purchase funnels
Less Tolerant
More Tolerant
41. There’s the last mile latency too
(and routers, other networking kit, mobile latencies too)
https://www.flickr.com/photos/kiwanja/3170292282
42. TCP and the Lower Bound of Web Performance!
John Rauser
Will probably need more than one round trip
71kB
143kB
214kB
285kB
1 2 3 4 5 6 7 8 9 10 11
(TCP Segments)
Round Trips
Size
43. We can cheat the latency penalty
(sometimes)
https://speakerdeck.com/mikeyk/secrets-to-lightning-fast-mobile-design
51. … into CSS Object Model (CSSOM)
body
h1 p
span
font-size: 16px
font-size: 16px
text-decoration: underline
font-size: 16px
font-weight: bold
font-size: 16px
font-weight: bold
color: #000
img
font-size: 16px
border: 1px solid #ccc
52. Combine DOM and CSSOM to build Render Tree
body
h1 p
img
font-size: 16px
text-decoration: underline
font-size: 16px
font-weight: bold
border: 1px solid #ccc
font-size: 16px
font-weight: bold
54. But what about JavaScript?
HTML
CSS
DOM
CSSOM
Render!
Tree
Layout PaintJavaScript
55. But what about JavaScript?
HTML
CSS
DOM
CSSOM
Render!
Tree
Layout PaintJavaScript
DOM
CSSOM
JavaScript
JavaScript blocks DOM construction!
CSSOM construction blocks JavaScript execution
56. async attribute avoids JavaScript blocking DOM construction
!
<script async src="myscript.js"></script>
Widely supported - 89.59% (http://caniuse.com/script-async)!
!
Doesn’t incur delays of using inline script to load other scripts e.g.
Google Analytics snippet
63. A proposal that may help…
font-display: auto | block | swap | fallback | optional;
https://tabatkins.github.io/specs/css-font-rendering/
Proposal to help control font blocking - CSS Font Rendering Controls
64. Another proposal that should help - link rel=“preload”…
https://w3c.github.io/preload/
<!-- preload a widget component -->
<link rel="preload" href="/components/widget.html" as="iframe">
!
<!-- preload an application script -->
<link rel="preload" href="/app/script.js" as="javascript">
!
<!-- preload a CSS stylesheet -->
<link rel="preload" href="/style/style.css" as="stylesheet">
!
<!-- preload a font -->
<link rel="preload" href="//example.com/font.woff2" as="font">
!
<!-- preload an image asset -->
<link rel="preload" href="//example.com/image.jpg" as="image" media="max-width: 640px">
65. Some other ways of hinting are already here
<link rel="dns-prefetch" href="other.hostname.com">
!
<link rel="subresource" href="/some_other_resource.js">
!
<link rel="prefetch" href="/some_other_resource.jpeg">
!
<link rel="prerender" href=“//domain.com/next_page.html”>