@basgr from @peakaceag#SMX #32A
Bastian Grimm, Peak Ace AG | @basgr
Next-gen performance optimization - the 2018 edition
How fast is fast enough?
#SMX #32A @basgr from @peakaceag
I’ve got some serious issues…
#SMX #32A @basgr from @peakaceag
For me, there is nothing worse than having to wait for anything to load!
I’m not a very patient guy…
#SMX #32A @basgr from @peakaceag
Fast loading time plays an important role in overall user experience!
Performance = User experience!
#SMX #32A @basgr from @peakaceag
Revisited: PageSpeed (load time) is a ranking factor
Source: http://pa.ag/2iAmA4Y & http://pa.ag/2ERTPYY
#SMX #32A @basgr from @peakaceag
Google is obsessed site speed and keeps pushing for
faster sites all the time!
#SMX #32A @basgr from @peakaceag
Cognitive load with stressful situations
Source: Ericsson ConsumerLab, Neurons Inc. 2015
Solving a math problem
Experiencing mobile delays
Watching a horror movie
Standing at the edge of a virtual cliff
Watching a melodramatic TV show
Waiting in line at a retail store
Level of stress caused by
delays on mobile is
comparable to watching
a horror movie!
#SMX #32A @basgr from @peakaceag
Let’s get this straight – this is what your users expect:
Obviously, slow page loading time is a major factor in page abandonment.
According to a Nielsen report, 47% of people expect a
website to load within two seconds, and 40% will leave a
website if it does not load fully within three seconds.”
#SMX #32A @basgr from @peakaceag
Because the PageSpeed Insights score is not enough!
#1 Better measurement
#SMX #32A @basgr from @peakaceag
Translating experiences to performance metrics:
User experience
▪ Is it happening?
› Did the navigation start successfully?
Has the server responded?
▪ Is it useful?
› Has enough content rendered for users
to engage with it?
▪ Is it usable?
› Can users interact with the page or is it
still busy loading?
▪ Is it smooth/delightful?
› Are the interactions smooth and
natural, free of lag and jank?
Corresponding metric
First Paint (FP) / First Contentful Paint (FCP)
First Meaningful Paint (FMP) -> Hero Element Timing
Time to Interactive (TTI)
Long tasks (technically the absence of those long tasks)
#SMX #32A @basgr from @peakaceag
Optimizing and measuring for painting timings
#1 #2
First Paint (FP)
Time to First Paint – marks the point when the
browser starts to render something, the first bit of
content on the screen.
#SMX #32A @basgr from @peakaceag
Optimizing and measuring for painting timings
#1 #2 #3 #4
First Paint (FP) First Contentful
Paint (FCP)
Time to First Paint – marks the point when the
browser starts to render something, the first bit of
content on the screen.
Time to First Contentful Paint – marks the point when
the browser renders the first bit of content from the
DOM, text, an image etc.
#SMX #32A @basgr from @peakaceag
Optimizing and measuring for painting timings
#1 #2 #3 #4 #5 #6
First Paint (FP) First Contentful
Paint (FCP)
First Meaningful
Paint (FMP) / Hero!
Time to Interactive
(TTI)
Time to First Paint – marks the point when the
browser starts to render something, the first bit of
content on the screen.
Time to First Contentful Paint – marks the point when
the browser renders the first bit of content from the
DOM, text, an image etc.
#SMX #32A @basgr from @peakaceag
Care about your Hero (Element)!
Optimize for First Meaningful Paint
#SMX #32A @basgr from @peakaceag
Track paint timings with Google Analytics (in theory)
Get the tracking code snippets: http://pa.ag/2viHQSz
version 62 and up
You must ensure your
PerformanceObserver is
registered in the <head>
before any stylesheets, so it
runs before FP/FCP happens.
(a buffered flag TBD in v.2)
#SMX #32A @basgr from @peakaceag
This is how it looks like in Google Analytics
Behavior > events > pages: performance metrics [first-contentful-paint]
Source: Google Analytics
#SMX #32A @basgr from @peakaceag
The cool kids’ way of doing this (using GTM):
#1 #3
#2 #4
#SMX #32A @basgr from @peakaceag
Combine it with Google Data Studio:
Test it: http://pa.ag/2Ee550q
#SMX #32A @basgr from @peakaceag
The code and resources required to render the initial view of a web page
#2 Critical rendering path
#SMX #32A @basgr from @peakaceag
Critical rendering path optimization
Initial view
(critical)
Below the fold
(not critical)
#SMX #32A @basgr from @peakaceag
CSSOM: the CSS Object Model
▪ The CSSOM is a “map” of the CSS styles
found on a web page.
▪ It’s much like the DOM (Document Object
Model), but for CSS rather than HTML.
▪ The CSSOM combined with the DOM is
used by browsers to display web pages.
body
font-size:16px;
h1
font-size:22px;
p
font-size:16px;
p
font-size:12px;
a
font-size:12px;
img
font-size:16px;
#SMX #32A @basgr from @peakaceag
Web browsers use the CSSOM to render a page
#SMX #32A @basgr from @peakaceag
Google doesn’t make a single GET request for its CSS!
#SMX #32A @basgr from @peakaceag
How to know which CSS is critically required?
▪ Minimum: a snapshot of CSS rules to
render a default desktop resolution (e.g.
1280x1024).
▪ Better: various snapshots for mobile
phones, pad/s & desktop/s – a lot of work!
Source: http://pa.ag/2o4x0uE
#SMX #32A @basgr from @peakaceag
My favorite: “critical” (using Node / Phantom JS)
Renders a site in multiple resolutions & builds a combined and compressed CRP CSS:
Critical & criticalCSS on GitHub: http://pa.ag/2wJTZAu & http://pa.ag/2wT1ST9
#SMX #32A @basgr from @peakaceag
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>CRP loading demo</title>
<!-- critical CSS goes here -->
<style> h1 { color: green; } </style>
<!-- use async preload // no IE, Edge & some other unimportant ones (http://caniuse.com/#search=preload) -->
<link rel="preload" href="non-critical.css" as="style" onload="this.rel='stylesheet'" />
<!--noscript for req. without JS -->
<noscript><link rel="stylesheet" href="non-critical.css"></noscript>
<!-- include polyfill for shitty browsers -->
<script>
*! loadCSS. [c]2017 Filament Group, Inc. MIT License */
(function(){ ... } ());
/*! loadCSS rel=preload polyfill. [c] 2017 Filament Group, Inc. MIT License */
(function(){ ... } ());
</script>
</head>
<body>
</body>
</html>
<!-- use async preload // no IE, Edge & some other unimportant ones
(http://caniuse.com/#search=preload) -->
<link rel="preload" href="non-critical.css" as="style" onload="this.rel='stylesheet'" />
<!-- critical CSS goes here -->
<style> h1 { color: green; } </style>
<!-- use async preload // no IE, Edge & some other unimportant ones
(http://caniuse.com/#search=preload) -->
<link rel="preload" href="non-critical.css" as="style" onload="this.rel='stylesheet'" />
<!--noscript for req. without JS -->
<noscript><link rel="stylesheet" href="non-critical.css"></noscript>
*! loadCSS. [c]2017 Filament Group, Inc. MIT License */
(function(){ ... } ());
/*! loadCSS rel=preload polyfill. [c] 2017 Filament Group, Inc. MIT License */
(function(){ ... } ());
Putting it all together
Fit the HTML, CSS & JS that’s necessary for “Start Render” into that first 14 kB round trip!
Inline your critical CSS
1
Loading non-critical CSS
async using rel=“preload“
2
Apply the CSS once it has
finished loading via “onload“
3
Fallback for non-JS requests
4
Implement loadCSS script for
older browsers
5
#SMX #32A @basgr from @peakaceag
Let’s look at an actual implementation…
Is it worth the effort?
#SMX #32A @basgr from @peakaceag
Before & after: a fresh WordPress setup #1
HTTP, no HTTP/2, Twenty Seventeen theme (1x CSS, 8x JS, custom fonts), no caching
and no other performance optimizations
#SMX #32A @basgr from @peakaceag
Before & after: a fresh WordPress setup #2
HTTP, no HTTP/2, Twenty Seventeen theme (1x CSS, 8x JS, custom fonts), W3Total (CSS,
JS, HTML minify, caching, compression)
#SMX #32A @basgr from @peakaceag
Before & after: a fresh WordPress setup #3
HTTP, no HTTP/2, Twenty Seventeen theme (1x CSS, 8x JS, custom fonts), W3Total (CSS,
JS, HTML minify, caching, compression) + CRP CSS inlined
#SMX #32A @basgr from @peakaceag
Performance metrics comparison at a glance
Rendering starts significantly earlier; this allows for faster interaction with the site.
KPI / MEASUREMENT
Load Time
Time to First Byte (TTFB)
Start Render
Time to Interactive (TTI)
DEFAULT WP
1.357 sec
0.454 sec
1.000 sec
0.956 sec
BASIC PERFORMANCE
0.791 sec
0.159 sec
0.600 sec
0.931 sec
FULLY OPTIMIZED
0.789 sec
0.157 sec
0.410 sec
0.563 sec
(+32%)
(+41%)
#SMX #32A @basgr from @peakaceag
Implement proper tracking, measure “First Meaningful Paint” (Hero Element delivery).
Audit, clean and (afterwards) split CSS into two parts: “initial view” and “below the fold”.
Use “critical” to generate and inline your critical path CSS.
Use rel=“preload“ and “loadCSS” to async load below the fold / site-wide CSS.
Off-load all overhead (JS, etc.) to stay within 14kB for faster, initial paint.
#SMXInsights
Share these #SMXInsights on your social channels!
#SMX #32A @basgr from @peakaceag
Pretty, varied, colorful, and slow!
#3 Custom web fonts
#SMX #32A @basgr from @peakaceag
68% of all websites use at least one non-standard font!
Result: 114 kB additional data and on average 2.9 HTTP requests
Source: http://pa.ag/1BRUnbe
Font transfer size & font requests Sites with custom fonts
Font transfer size (kB) Font requests
#SMX #32A @basgr from @peakaceag
Classic scenario: using external CSS
Easy to use with one big disadvantage: CSS is render-blocking!
#SMX #32A @basgr from @peakaceag
Load custom fonts with FontLoader
Google's asynchronous solution: webfont.js (JavaScript loads first, then CSS)
#SMX #32A @basgr from @peakaceag
Not very successful and also problematic
FOUT (flash of unstyled text) = super annoying flickering
Fighting the FOUT: http://pa.ag/1BRWMmu
#SMX #32A @basgr from @peakaceag
How I usually tackle this
Credits: http://pa.ag/1GakitY & http://pa.ag/1NDXCVi
#SMX #32A @basgr from @peakaceag
New stuff to play around with: “font-display” strategies
More: http://pa.ag/2eUwVob
#SMX #32A @basgr from @peakaceag
Highest quality, (more) efficient data compression, smaller files
It hasn’t fully caught on yet, but it is very exciting!
#4 New image formats
#SMX #32A @basgr from @peakaceag
62% of all web traffic is made up of images...
… and 51% of all URLs load more than 40 images per request.
Source: http://pa.ag/1SGDOEo
Average bytes per page by content type Image requests per page
#SMX #32A @basgr from @peakaceag
WebP: Google’s alternative to JPEG, PNG, and GIF
Lossy and lossless compression, transparency, metadata, color profiles, animation, and
much smaller files (30% vs. JPEG, 80% vs. PNG)
Everything about WebP: http://pa.ag/1EpFWeN
#SMX #32A @basgr from @peakaceag
We’re not quite there yet...
Currently only supported by Chrome, Opera, and Android
Source: http://pa.ag/2FZK4XS
#SMX #32A @basgr from @peakaceag
You can still use WebP with on-the-fly replacement
Swap PNG and JPEG images per re-write (i.e., using .htaccess)
#SMX #32A @basgr from @peakaceag
You can still use WebP with on-the-fly replacement
Swap PNG and JPEG images per re-write (i.e., using .htaccess)
VS.
#SMX #32A @basgr from @peakaceag
Using HTML5 and <picture> with newer templates
Browsers, which don‘t support <picture> will ignore this. <source> browsers, which
don't support WebP, will use <img> as a fallback.
#SMX #32A @basgr from @peakaceag
There is more: FLIF, BPG etc.
Left: image size compared to original PNG
Further reading: http://pa.ag/1S5OQmX
#SMX #32A @basgr from @peakaceag
It really depends on the visual itself:
#SMX #32A @basgr from @peakaceag
Talking about image file types…
#SMX #32A @basgr from @peakaceag
Guetzli: 35% smaller JPEGs due to better encoding
No new file type needed at all; operating systems and browsers don’t need to adapt!
Source: http://pa.ag/2nyZjxf
#SMX #32A @basgr from @peakaceag
#5 … more?
@peakaceag with @basgr#SMX #32A
Make sure to get the basics right!
▪ Optimize images: reduce overhead for JPGs & PNGs (metadata,
etc.), request proper sized images and try new formats.
▪ Implement effective caching and compression.
▪ Whenever possible, use asynchronous requests.
▪ Decrease size of CSS and JavaScript files (minify).
▪ Use a content distribution network (CDN) / an asset server
(as well as cookie-less domains) to optimize parallel requests.
▪ Lean mark-up (no comments, use inline CSS / JS only where
necessary or useful)
▪ Consider (DNS) pre-fetching & pre-rendering if feasible.
▪ Watch (& optimize) for TTFB, don’t forget you back-end
architecture / systems (e.g. DB, webserver etc.).
All slides on SlideShare: http://pa.ag/iss17speed
Use my checklist on SlideShare to double check:
#SMX #32A @basgr from @peakaceag
http://pa.ag/smxw18spd
Always looking for talent! Check out jobs.pa.ag
Bastian Grimm
bg@pa.ag
twitter.com/peakaceag
facebook.com/peakaceag
www.pa.ag
Liked the deck? Here you go:

More Related Content

PDF
Whats Next in SEO & CRO - 3XE Conference 2018 Dublin
PDF
Welcome to a new reality - DeepCrawl Webinar 2018
PDF
AMP - SMX München 2018
PDF
Migration Best-Practices: Successfully re-launching your website - SMX New Yo...
PDF
Super speed around the globe - SearchLeeds 2018
PDF
Migration Best Practices - SMX London 2018
PDF
Web Performance Madness - brightonSEO 2018
PDF
International Site Speed Tweaks - ISS 2017 Barcelona
Whats Next in SEO & CRO - 3XE Conference 2018 Dublin
Welcome to a new reality - DeepCrawl Webinar 2018
AMP - SMX München 2018
Migration Best-Practices: Successfully re-launching your website - SMX New Yo...
Super speed around the globe - SearchLeeds 2018
Migration Best Practices - SMX London 2018
Web Performance Madness - brightonSEO 2018
International Site Speed Tweaks - ISS 2017 Barcelona

What's hot (20)

PDF
Technical SEO vs. User Experience - Bastian Grimm, Peak Ace AG
PDF
The need for Speed: Advanced #webperf - SEOday 2018
PDF
OK Google, Whats next? - OMT Wiesbaden 2018
PDF
Migration Best Practices - SMX West 2019
PDF
Sabine Langmann - Brighton SEO 2018 - How to expand to different markets
PPTX
Three site speed optimisation tips to make your website REALLY fast - Brighto...
PDF
Migration Best Practices - SEOkomm 2018
PPTX
Migration Best Practices - Peak Ace on Air
PDF
Guide To Web Development
PPTX
How webpage loading takes place?
PDF
Migration Best Practices - Search Y 2019, Paris
PDF
The Need for Speed (5 Performance Optimization Tipps) - brightonSEO 2014
PDF
The latest in site speed: advanced #webperf 2018
PPTX
SearchLove San Diego 2018 | Mat Clayton | Site Speed for Digital Marketers
PPTX
Rendering SEO (explained by Google's Martin Splitt)
PDF
SearchLeeds 2018 - Bastian Grimm - Peak Ace - International site speed: Going...
PPTX
Structured Data & Schema.org - SMX Milan 2014
PPTX
Satisfying the Need for Speed (By Aleh Barysevich of SEO PowerSuite, SMX Lond...
PDF
Implementing schema.org in the JSON-LD format with Google Tag Manager
PPTX
10 Tips to make your Website lightning-fast - SMX Stockholm 2012
Technical SEO vs. User Experience - Bastian Grimm, Peak Ace AG
The need for Speed: Advanced #webperf - SEOday 2018
OK Google, Whats next? - OMT Wiesbaden 2018
Migration Best Practices - SMX West 2019
Sabine Langmann - Brighton SEO 2018 - How to expand to different markets
Three site speed optimisation tips to make your website REALLY fast - Brighto...
Migration Best Practices - SEOkomm 2018
Migration Best Practices - Peak Ace on Air
Guide To Web Development
How webpage loading takes place?
Migration Best Practices - Search Y 2019, Paris
The Need for Speed (5 Performance Optimization Tipps) - brightonSEO 2014
The latest in site speed: advanced #webperf 2018
SearchLove San Diego 2018 | Mat Clayton | Site Speed for Digital Marketers
Rendering SEO (explained by Google's Martin Splitt)
SearchLeeds 2018 - Bastian Grimm - Peak Ace - International site speed: Going...
Structured Data & Schema.org - SMX Milan 2014
Satisfying the Need for Speed (By Aleh Barysevich of SEO PowerSuite, SMX Lond...
Implementing schema.org in the JSON-LD format with Google Tag Manager
10 Tips to make your Website lightning-fast - SMX Stockholm 2012
Ad

Similar to How fast is fast enough - SMX West 2018 (20)

PPTX
Building high performing web pages
PDF
SMX_DevTools_Monaco_2.pdf
PPTX
Accelerated Mobile - Beyond AMP
PDF
Navigating the critical rendering path - Jamie Alberico - VirtuaCon
PPTX
SMX Advanced 2018 SEO for Javascript Frameworks by Patrick Stox
PPTX
The Speed Update: Faster is Better for Everyone [Aleh Barysevich, SMXeast 2018]
PDF
Magento 2 Front-end performance tips & tricks - Meet Magento Romania 2017
PDF
Exploring Critical Rendering Path
PDF
フロントエンドエンジニア(仮) 〜え、ちょっとフロントやること多すぎじゃない!?〜
PPTX
MongoDB.local Atlanta: MongoDB Stitch Tutorial
PPTX
Presentation Tier optimizations
PPTX
Max Prin - MnSearch Summit 2017 - What does technical SEO look like in 2017?
PDF
Complete SEO Report with checklist required
PDF
Preconnect, prefetch, prerender...
PPTX
MongoDB.local Seattle 2019: MongoDB Stitch Tutorial
PPTX
Troubleshooting SEO for JS Frameworks - Patrick Stox - DTD 2018
PPT
Web performance tuning
PDF
Pump up the JAM with Gatsby (2019)
PDF
Frontend Performance: Illusions & browser rendering
PPTX
MongoDB.local Dallas 2019: MongoDB Stitch Tutorial
Building high performing web pages
SMX_DevTools_Monaco_2.pdf
Accelerated Mobile - Beyond AMP
Navigating the critical rendering path - Jamie Alberico - VirtuaCon
SMX Advanced 2018 SEO for Javascript Frameworks by Patrick Stox
The Speed Update: Faster is Better for Everyone [Aleh Barysevich, SMXeast 2018]
Magento 2 Front-end performance tips & tricks - Meet Magento Romania 2017
Exploring Critical Rendering Path
フロントエンドエンジニア(仮) 〜え、ちょっとフロントやること多すぎじゃない!?〜
MongoDB.local Atlanta: MongoDB Stitch Tutorial
Presentation Tier optimizations
Max Prin - MnSearch Summit 2017 - What does technical SEO look like in 2017?
Complete SEO Report with checklist required
Preconnect, prefetch, prerender...
MongoDB.local Seattle 2019: MongoDB Stitch Tutorial
Troubleshooting SEO for JS Frameworks - Patrick Stox - DTD 2018
Web performance tuning
Pump up the JAM with Gatsby (2019)
Frontend Performance: Illusions & browser rendering
MongoDB.local Dallas 2019: MongoDB Stitch Tutorial
Ad

More from Bastian Grimm (14)

PDF
SEOday Köln 2020 - Surprise, Surprise - 5 SEO secrets
PDF
Advanced data-driven technical SEO - SMX London 2019
PDF
Data-driven Technical SEO: Logfile Auditing - SEOkomm 2018
PDF
Digitale Assistenzsysteme - SMX München 2018
PDF
Migration Best-Practices: So gelingt der erfolgreiche Relaunch - SEOkomm 2017
PDF
Digitale Assistenten - OMX 2017
PDF
Welcome to a New Reality - SEO goes Mobile First in 2017
PPTX
Welcome to a New Reality - SEO goes Mobile First in 2017
PPTX
HTTPs Migration How To - SMX München 2017
PPTX
Keyword Strategie: Do's & Don'ts bei der Keyword Recherche - SMX München 2017
PPTX
Technical SEO: 2017 Edition - SEO & Love Verona 2017
PPTX
Quo Vadis SEO (Die Zukunft des SEO) - SEOkomm Salzburg 2016
PDF
Technical SEO: 2016 Edition - SEODAY 2016
PDF
Crawl Budget Best Practices - SEODAY 2016
SEOday Köln 2020 - Surprise, Surprise - 5 SEO secrets
Advanced data-driven technical SEO - SMX London 2019
Data-driven Technical SEO: Logfile Auditing - SEOkomm 2018
Digitale Assistenzsysteme - SMX München 2018
Migration Best-Practices: So gelingt der erfolgreiche Relaunch - SEOkomm 2017
Digitale Assistenten - OMX 2017
Welcome to a New Reality - SEO goes Mobile First in 2017
Welcome to a New Reality - SEO goes Mobile First in 2017
HTTPs Migration How To - SMX München 2017
Keyword Strategie: Do's & Don'ts bei der Keyword Recherche - SMX München 2017
Technical SEO: 2017 Edition - SEO & Love Verona 2017
Quo Vadis SEO (Die Zukunft des SEO) - SEOkomm Salzburg 2016
Technical SEO: 2016 Edition - SEODAY 2016
Crawl Budget Best Practices - SEODAY 2016

Recently uploaded (20)

PPTX
在线订购名古屋艺术大学毕业证, buy NUA diploma学历认证失败怎么办
PPTX
Basic understanding of cloud computing one need
PDF
Computer Networking, Internet, Casting in Network
PDF
The Evolution of Traditional to New Media .pdf
PDF
Course Overview and Agenda cloud security
PDF
Understand the Gitlab_presentation_task.pdf
PDF
simpleintnettestmetiaerl for the simple testint
PPTX
module 1-Part 1.pptxdddddddddddddddddddddddddddddddddddd
PDF
Exploring The Internet Of Things(IOT).ppt
PDF
Virtual Guard Technology Provider_ Remote Security Service Solutions.pdf
PPTX
Artificial_Intelligence_Basics use in our daily life
PDF
BIOCHEM CH2 OVERVIEW OF MICROBIOLOGY.pdf
PDF
healthwealthtech4all-blogspot-com-2025-08-top-5-tech-innovations-that-will-ht...
PPTX
Reading as a good Form of Recreation
PPTX
Layers_of_the_Earth_Grade7.pptx class by
PDF
Buy Cash App Verified Accounts Instantly – Secure Crypto Deal.pdf
PPTX
KSS ON CYBERSECURITY INCIDENT RESPONSE AND PLANNING MANAGEMENT.pptx
PDF
Alethe Consulting Corporate Profile and Solution Aproach
PPTX
Viva Digitally Software-Defined Wide Area Network.pptx
PPTX
Top Website Bugs That Hurt User Experience – And How Expert Web Design Fixes
在线订购名古屋艺术大学毕业证, buy NUA diploma学历认证失败怎么办
Basic understanding of cloud computing one need
Computer Networking, Internet, Casting in Network
The Evolution of Traditional to New Media .pdf
Course Overview and Agenda cloud security
Understand the Gitlab_presentation_task.pdf
simpleintnettestmetiaerl for the simple testint
module 1-Part 1.pptxdddddddddddddddddddddddddddddddddddd
Exploring The Internet Of Things(IOT).ppt
Virtual Guard Technology Provider_ Remote Security Service Solutions.pdf
Artificial_Intelligence_Basics use in our daily life
BIOCHEM CH2 OVERVIEW OF MICROBIOLOGY.pdf
healthwealthtech4all-blogspot-com-2025-08-top-5-tech-innovations-that-will-ht...
Reading as a good Form of Recreation
Layers_of_the_Earth_Grade7.pptx class by
Buy Cash App Verified Accounts Instantly – Secure Crypto Deal.pdf
KSS ON CYBERSECURITY INCIDENT RESPONSE AND PLANNING MANAGEMENT.pptx
Alethe Consulting Corporate Profile and Solution Aproach
Viva Digitally Software-Defined Wide Area Network.pptx
Top Website Bugs That Hurt User Experience – And How Expert Web Design Fixes

How fast is fast enough - SMX West 2018

  • 1. @basgr from @peakaceag#SMX #32A Bastian Grimm, Peak Ace AG | @basgr Next-gen performance optimization - the 2018 edition How fast is fast enough?
  • 2. #SMX #32A @basgr from @peakaceag I’ve got some serious issues…
  • 3. #SMX #32A @basgr from @peakaceag For me, there is nothing worse than having to wait for anything to load! I’m not a very patient guy…
  • 4. #SMX #32A @basgr from @peakaceag Fast loading time plays an important role in overall user experience! Performance = User experience!
  • 5. #SMX #32A @basgr from @peakaceag Revisited: PageSpeed (load time) is a ranking factor Source: http://pa.ag/2iAmA4Y & http://pa.ag/2ERTPYY
  • 6. #SMX #32A @basgr from @peakaceag Google is obsessed site speed and keeps pushing for faster sites all the time!
  • 7. #SMX #32A @basgr from @peakaceag Cognitive load with stressful situations Source: Ericsson ConsumerLab, Neurons Inc. 2015 Solving a math problem Experiencing mobile delays Watching a horror movie Standing at the edge of a virtual cliff Watching a melodramatic TV show Waiting in line at a retail store Level of stress caused by delays on mobile is comparable to watching a horror movie!
  • 8. #SMX #32A @basgr from @peakaceag Let’s get this straight – this is what your users expect: Obviously, slow page loading time is a major factor in page abandonment. According to a Nielsen report, 47% of people expect a website to load within two seconds, and 40% will leave a website if it does not load fully within three seconds.”
  • 9. #SMX #32A @basgr from @peakaceag Because the PageSpeed Insights score is not enough! #1 Better measurement
  • 10. #SMX #32A @basgr from @peakaceag Translating experiences to performance metrics: User experience ▪ Is it happening? › Did the navigation start successfully? Has the server responded? ▪ Is it useful? › Has enough content rendered for users to engage with it? ▪ Is it usable? › Can users interact with the page or is it still busy loading? ▪ Is it smooth/delightful? › Are the interactions smooth and natural, free of lag and jank? Corresponding metric First Paint (FP) / First Contentful Paint (FCP) First Meaningful Paint (FMP) -> Hero Element Timing Time to Interactive (TTI) Long tasks (technically the absence of those long tasks)
  • 11. #SMX #32A @basgr from @peakaceag Optimizing and measuring for painting timings #1 #2 First Paint (FP) Time to First Paint – marks the point when the browser starts to render something, the first bit of content on the screen.
  • 12. #SMX #32A @basgr from @peakaceag Optimizing and measuring for painting timings #1 #2 #3 #4 First Paint (FP) First Contentful Paint (FCP) Time to First Paint – marks the point when the browser starts to render something, the first bit of content on the screen. Time to First Contentful Paint – marks the point when the browser renders the first bit of content from the DOM, text, an image etc.
  • 13. #SMX #32A @basgr from @peakaceag Optimizing and measuring for painting timings #1 #2 #3 #4 #5 #6 First Paint (FP) First Contentful Paint (FCP) First Meaningful Paint (FMP) / Hero! Time to Interactive (TTI) Time to First Paint – marks the point when the browser starts to render something, the first bit of content on the screen. Time to First Contentful Paint – marks the point when the browser renders the first bit of content from the DOM, text, an image etc.
  • 14. #SMX #32A @basgr from @peakaceag Care about your Hero (Element)! Optimize for First Meaningful Paint
  • 15. #SMX #32A @basgr from @peakaceag Track paint timings with Google Analytics (in theory) Get the tracking code snippets: http://pa.ag/2viHQSz version 62 and up You must ensure your PerformanceObserver is registered in the <head> before any stylesheets, so it runs before FP/FCP happens. (a buffered flag TBD in v.2)
  • 16. #SMX #32A @basgr from @peakaceag This is how it looks like in Google Analytics Behavior > events > pages: performance metrics [first-contentful-paint] Source: Google Analytics
  • 17. #SMX #32A @basgr from @peakaceag The cool kids’ way of doing this (using GTM): #1 #3 #2 #4
  • 18. #SMX #32A @basgr from @peakaceag Combine it with Google Data Studio: Test it: http://pa.ag/2Ee550q
  • 19. #SMX #32A @basgr from @peakaceag The code and resources required to render the initial view of a web page #2 Critical rendering path
  • 20. #SMX #32A @basgr from @peakaceag Critical rendering path optimization Initial view (critical) Below the fold (not critical)
  • 21. #SMX #32A @basgr from @peakaceag CSSOM: the CSS Object Model ▪ The CSSOM is a “map” of the CSS styles found on a web page. ▪ It’s much like the DOM (Document Object Model), but for CSS rather than HTML. ▪ The CSSOM combined with the DOM is used by browsers to display web pages. body font-size:16px; h1 font-size:22px; p font-size:16px; p font-size:12px; a font-size:12px; img font-size:16px;
  • 22. #SMX #32A @basgr from @peakaceag Web browsers use the CSSOM to render a page
  • 23. #SMX #32A @basgr from @peakaceag Google doesn’t make a single GET request for its CSS!
  • 24. #SMX #32A @basgr from @peakaceag How to know which CSS is critically required? ▪ Minimum: a snapshot of CSS rules to render a default desktop resolution (e.g. 1280x1024). ▪ Better: various snapshots for mobile phones, pad/s & desktop/s – a lot of work! Source: http://pa.ag/2o4x0uE
  • 25. #SMX #32A @basgr from @peakaceag My favorite: “critical” (using Node / Phantom JS) Renders a site in multiple resolutions & builds a combined and compressed CRP CSS: Critical & criticalCSS on GitHub: http://pa.ag/2wJTZAu & http://pa.ag/2wT1ST9
  • 26. #SMX #32A @basgr from @peakaceag <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width"> <title>CRP loading demo</title> <!-- critical CSS goes here --> <style> h1 { color: green; } </style> <!-- use async preload // no IE, Edge & some other unimportant ones (http://caniuse.com/#search=preload) --> <link rel="preload" href="non-critical.css" as="style" onload="this.rel='stylesheet'" /> <!--noscript for req. without JS --> <noscript><link rel="stylesheet" href="non-critical.css"></noscript> <!-- include polyfill for shitty browsers --> <script> *! loadCSS. [c]2017 Filament Group, Inc. MIT License */ (function(){ ... } ()); /*! loadCSS rel=preload polyfill. [c] 2017 Filament Group, Inc. MIT License */ (function(){ ... } ()); </script> </head> <body> </body> </html> <!-- use async preload // no IE, Edge & some other unimportant ones (http://caniuse.com/#search=preload) --> <link rel="preload" href="non-critical.css" as="style" onload="this.rel='stylesheet'" /> <!-- critical CSS goes here --> <style> h1 { color: green; } </style> <!-- use async preload // no IE, Edge & some other unimportant ones (http://caniuse.com/#search=preload) --> <link rel="preload" href="non-critical.css" as="style" onload="this.rel='stylesheet'" /> <!--noscript for req. without JS --> <noscript><link rel="stylesheet" href="non-critical.css"></noscript> *! loadCSS. [c]2017 Filament Group, Inc. MIT License */ (function(){ ... } ()); /*! loadCSS rel=preload polyfill. [c] 2017 Filament Group, Inc. MIT License */ (function(){ ... } ()); Putting it all together Fit the HTML, CSS & JS that’s necessary for “Start Render” into that first 14 kB round trip! Inline your critical CSS 1 Loading non-critical CSS async using rel=“preload“ 2 Apply the CSS once it has finished loading via “onload“ 3 Fallback for non-JS requests 4 Implement loadCSS script for older browsers 5
  • 27. #SMX #32A @basgr from @peakaceag Let’s look at an actual implementation… Is it worth the effort?
  • 28. #SMX #32A @basgr from @peakaceag Before & after: a fresh WordPress setup #1 HTTP, no HTTP/2, Twenty Seventeen theme (1x CSS, 8x JS, custom fonts), no caching and no other performance optimizations
  • 29. #SMX #32A @basgr from @peakaceag Before & after: a fresh WordPress setup #2 HTTP, no HTTP/2, Twenty Seventeen theme (1x CSS, 8x JS, custom fonts), W3Total (CSS, JS, HTML minify, caching, compression)
  • 30. #SMX #32A @basgr from @peakaceag Before & after: a fresh WordPress setup #3 HTTP, no HTTP/2, Twenty Seventeen theme (1x CSS, 8x JS, custom fonts), W3Total (CSS, JS, HTML minify, caching, compression) + CRP CSS inlined
  • 31. #SMX #32A @basgr from @peakaceag Performance metrics comparison at a glance Rendering starts significantly earlier; this allows for faster interaction with the site. KPI / MEASUREMENT Load Time Time to First Byte (TTFB) Start Render Time to Interactive (TTI) DEFAULT WP 1.357 sec 0.454 sec 1.000 sec 0.956 sec BASIC PERFORMANCE 0.791 sec 0.159 sec 0.600 sec 0.931 sec FULLY OPTIMIZED 0.789 sec 0.157 sec 0.410 sec 0.563 sec (+32%) (+41%)
  • 32. #SMX #32A @basgr from @peakaceag Implement proper tracking, measure “First Meaningful Paint” (Hero Element delivery). Audit, clean and (afterwards) split CSS into two parts: “initial view” and “below the fold”. Use “critical” to generate and inline your critical path CSS. Use rel=“preload“ and “loadCSS” to async load below the fold / site-wide CSS. Off-load all overhead (JS, etc.) to stay within 14kB for faster, initial paint. #SMXInsights Share these #SMXInsights on your social channels!
  • 33. #SMX #32A @basgr from @peakaceag Pretty, varied, colorful, and slow! #3 Custom web fonts
  • 34. #SMX #32A @basgr from @peakaceag 68% of all websites use at least one non-standard font! Result: 114 kB additional data and on average 2.9 HTTP requests Source: http://pa.ag/1BRUnbe Font transfer size & font requests Sites with custom fonts Font transfer size (kB) Font requests
  • 35. #SMX #32A @basgr from @peakaceag Classic scenario: using external CSS Easy to use with one big disadvantage: CSS is render-blocking!
  • 36. #SMX #32A @basgr from @peakaceag Load custom fonts with FontLoader Google's asynchronous solution: webfont.js (JavaScript loads first, then CSS)
  • 37. #SMX #32A @basgr from @peakaceag Not very successful and also problematic FOUT (flash of unstyled text) = super annoying flickering Fighting the FOUT: http://pa.ag/1BRWMmu
  • 38. #SMX #32A @basgr from @peakaceag How I usually tackle this Credits: http://pa.ag/1GakitY & http://pa.ag/1NDXCVi
  • 39. #SMX #32A @basgr from @peakaceag New stuff to play around with: “font-display” strategies More: http://pa.ag/2eUwVob
  • 40. #SMX #32A @basgr from @peakaceag Highest quality, (more) efficient data compression, smaller files It hasn’t fully caught on yet, but it is very exciting! #4 New image formats
  • 41. #SMX #32A @basgr from @peakaceag 62% of all web traffic is made up of images... … and 51% of all URLs load more than 40 images per request. Source: http://pa.ag/1SGDOEo Average bytes per page by content type Image requests per page
  • 42. #SMX #32A @basgr from @peakaceag WebP: Google’s alternative to JPEG, PNG, and GIF Lossy and lossless compression, transparency, metadata, color profiles, animation, and much smaller files (30% vs. JPEG, 80% vs. PNG) Everything about WebP: http://pa.ag/1EpFWeN
  • 43. #SMX #32A @basgr from @peakaceag We’re not quite there yet... Currently only supported by Chrome, Opera, and Android Source: http://pa.ag/2FZK4XS
  • 44. #SMX #32A @basgr from @peakaceag You can still use WebP with on-the-fly replacement Swap PNG and JPEG images per re-write (i.e., using .htaccess)
  • 45. #SMX #32A @basgr from @peakaceag You can still use WebP with on-the-fly replacement Swap PNG and JPEG images per re-write (i.e., using .htaccess) VS.
  • 46. #SMX #32A @basgr from @peakaceag Using HTML5 and <picture> with newer templates Browsers, which don‘t support <picture> will ignore this. <source> browsers, which don't support WebP, will use <img> as a fallback.
  • 47. #SMX #32A @basgr from @peakaceag There is more: FLIF, BPG etc. Left: image size compared to original PNG Further reading: http://pa.ag/1S5OQmX
  • 48. #SMX #32A @basgr from @peakaceag It really depends on the visual itself:
  • 49. #SMX #32A @basgr from @peakaceag Talking about image file types…
  • 50. #SMX #32A @basgr from @peakaceag Guetzli: 35% smaller JPEGs due to better encoding No new file type needed at all; operating systems and browsers don’t need to adapt! Source: http://pa.ag/2nyZjxf
  • 51. #SMX #32A @basgr from @peakaceag #5 … more?
  • 52. @peakaceag with @basgr#SMX #32A Make sure to get the basics right! ▪ Optimize images: reduce overhead for JPGs & PNGs (metadata, etc.), request proper sized images and try new formats. ▪ Implement effective caching and compression. ▪ Whenever possible, use asynchronous requests. ▪ Decrease size of CSS and JavaScript files (minify). ▪ Use a content distribution network (CDN) / an asset server (as well as cookie-less domains) to optimize parallel requests. ▪ Lean mark-up (no comments, use inline CSS / JS only where necessary or useful) ▪ Consider (DNS) pre-fetching & pre-rendering if feasible. ▪ Watch (& optimize) for TTFB, don’t forget you back-end architecture / systems (e.g. DB, webserver etc.). All slides on SlideShare: http://pa.ag/iss17speed Use my checklist on SlideShare to double check:
  • 53. #SMX #32A @basgr from @peakaceag http://pa.ag/smxw18spd Always looking for talent! Check out jobs.pa.ag Bastian Grimm [email protected] twitter.com/peakaceag facebook.com/peakaceag www.pa.ag Liked the deck? Here you go: