SlideShare a Scribd company logo
Killer performance
Jonas Ohlsson
@pocketjoso
Jonas Ohlsson
Front end developer at State
Perf and tooling geek
Author of Penthouse
https://github.com/pocketjoso/penthouse/
Killer page load performance
10 seconds later
https://www.facebook.com/instantArticles
Is the Web slow?
http://www.quirksmode.org/blog/archives/2015/05/web_vs_native_l.html
Killer page load performance
Are heavy JS frameworks
responsible for the slow
web?
Page Load
Perceived load
Killer page load performance
Start Render
Total Page Load Time
http://webpagetest.org
SpeedIndex
1 second to
“break the glass”
https://developers.google.com/speed/docs/insights/mobile
(Request) Latency kills
mobile performance
https://developers.google.com/speed/docs/insights/mobile
Page Load
#perfmatters
https://twitter.com/hashtag/perfmatters
http://www.webperformancetoday.com/2012/02/28/4-awesome-slides-showing-how-page-speed-correlates-to-business-metrics-at-walmart-com/
http://kylerush.net/blog/meet-the-obama-campaigns-250-million-fundraising-platform/
https://blog.mozilla.org/metrics/2010/04/05/firefox-page-load-speed-%E2%80%93-part-ii/
Page Load
https://developers.google.com/speed/pagespeed/insights/
https://developers.google.com/speed/pagespeed/insights/
http://webpagetest.org
WebPageTest CLI / Node module
https://github.com/marcelduran/webpagetest-api
Perf budget (grunt)
https://github.com/tkadlec/grunt-perfbudget
http://timkadlec.com/2015/05/choosing-performance/
http://www.filamentgroup.com/lab/weight-wait.html
http://www.filamentgroup.com/lab/weight-wait.html
Critical Path for rendering
HTML
<html>
<head>
<script src=‘bundle.js’>
</script>
<link rel=‘style’
href=‘styles.css’></link>
</head>
<body>
…
</body>
</html>
CSS
JS
Start render
<html>
<head>
<link rel=‘style’
href=‘styles.css’></link>
</head>
<body>
…
<script src=‘bundle.js’>
</script>
</body>
</html>
Start render
HTML
CSS
JS
<html>
<head>
</head>
<body>
…
<script src=‘bundle.js’>
</script>
<link rel=‘style’
href=‘styles.css’></link>
</body>
</html>
Start render
HTML
CSS
JS
Killer page load performance
<html>
<head>
<style>
/* critical styles for page*/
</style>
</head>
<body>
…
<script src=‘bundle.js’>
</script>
<link rel=‘style’
href=‘styles.css’></link>
</body>
</html>
Start render
HTML
CSS
JS
<html>
<head>
<style>
/* critical styles for page*/
</style>
<script src=‘bundle.js’ async>
</script>
</head>
<body>
…
<link rel=‘style’
href=‘styles.css’></link>
</body>
</html>
Start render
HTML
CSS
JS
<html>
<head>
<style>
/* critical styles for page*/
</style>
<script>function loadCss()…
loadCss(‘styles.css’);
</script>
<script src=‘bundle.js’ async>
</script>
</head>
<body>
…
</body>
</html>
Start render
HTML
CSS
JS
https://github.com/filamentgroup/loadCSS
TCP slow start
First roundtrip only fits ~14kb
Styles needed to render immediately visible content
~ “above the fold”
Per page
Critical Path CSS
https://github.com/addyosmani/critical/
Critical path css generators
Manually
http://jonassebastianohlsson.com/criticalpathcssgenerator
Static content
https://github.com/addyosmani/critical
CLI or build process (node, gulp, grunt)
https://github.com/pocketjoso/penthouse
Automating Critical Css
grunt-penthouse
penthouse: {
home : {
css : ‘styles/fullCss.css’,
url : ‘localhost:8000/’,
outfile : 'index.html.css',
width : 1300, height : 900
}
}
grunt-penthouse
penthouse: {
home : {
css : ‘styles/fullCss.css’,
url : ‘localhost:8000/’,
outfile : 'index.html.css',
width : 1300, height : 900
},
work : {
css : ‘styles/fullCss.css’,
url : ‘localhost:8000/work/’,
outfile : 'work/index.html.css',
width : 1300, height : 900
},
..
Rewrite relative paths
<link rel=‘style’
href=‘css/styles.css’>
</link>
// css
url: (‘../fonts/Lato.woff’)
// inline in <head>
<style>
url: (‘fonts/Lato.woff’)
</style>
penthouse (Node)
[ ‘localhost:8000/’,
‘localhost:8000/work/’
].map(function(url){
penthouse({
css : ‘styles/fullCss.css’,
url : url,
width : 1300, height : 900
}, function(err, criticalCss) {
if (err) return;
fs.writeFile(someFileName, criticalCss);
});
});
Using local files
[ ‘index.html’, // will be rendered over file protocol
‘work/index.html’
].map(function(url){
penthouse({
css : ‘styles/fullCss.css’,
url : url,
width : 1300, height : 900
}, function(err, criticalCss) {
if (err) return;
fs.writeFile(someFileName, criticalCss);
});
});
Serving critical css
<head>
{{#if criticalCss}}
<style>{{{ criticalCss }}}</style>
<script>
function loadCSS(){…}
loadCSS(‘{{ stylesUrl }}’);
</script>
{{else}}
<link rel='stylesheet' href='{{ stylesUrl }}' />
{{/if}}
</head>
Serving critical css
<head>
{{#if criticalCss}}
<style>{{{ criticalCss }}}</style>
<script>
function loadCSS(){…}
loadCSS(‘{{ stylesUrl }}’);
</script>
<noscript><link rel='stylesheet' href='{{
stylesUrl }}' /></noscript>
{{else}}
<link rel='stylesheet' href='{{ stylesUrl }}' />
{{/if}}
</head>
Flash Of Invisible Text
var ffObserver = new FontFaceObserver('Lato
Web', { weight: 400});
var ffBoldObserver = new
FontFaceObserver('Lato Web', { weight: 700});
window.Promise.all([
ffObserver.check(),
ffBoldObserver.check()
]).then(function(){
document.documentElement.className +=
‘ fonts-loaded’;
});
FontFaceObserver
https://github.com/bramstein/fontfaceobserver
body {
font-family: sans-serif;
};
.fonts-loaded body {
font-family: ‘Lato Web’, sans-serif;
}
FontFaceObserver
https://github.com/bramstein/fontfaceobserver
Killer page load performance
Questions?
Jonas Ohlsson
@pocketjoso

More Related Content

KEY
It's Mechanize for it. Ruby as a Finder.
PDF
Using Ember to Make a Bazillion Dollars
PDF
Survey of Front End Topics in Rails
PDF
Future of Web Development
PPTX
Learn how to start cooking with Chef!
PDF
Monitoring web application behaviour with cucumber-nagios
PDF
jQtouch, Building Awesome Webapps
PDF
Mozilla Web Apps - Super-VanJS
It's Mechanize for it. Ruby as a Finder.
Using Ember to Make a Bazillion Dollars
Survey of Front End Topics in Rails
Future of Web Development
Learn how to start cooking with Chef!
Monitoring web application behaviour with cucumber-nagios
jQtouch, Building Awesome Webapps
Mozilla Web Apps - Super-VanJS

What's hot (20)

PPTX
Souders WPO Web2.0Expo
PDF
I motion
PDF
KEY
a-blog cms 勉強会 NAGOYA 20110718
PDF
Mastering Grunt
PPTX
JSConf US 2010
PDF
Web Components: What, Why, How, and When
PDF
Liferay + Wearables
PDF
Streamlining Your Applications with Web Frameworks
KEY
Taking your Web App for a walk
PDF
Create and Deploy Ember in 5 Minutes with Middleman
PDF
Just Your Type: Web Typography & You
PPTX
Build a Better Editing Experience with Advanced Custom Fields - #WCTO16
PPTX
Bower power
PPT
Web Application Introduction
PDF
Cheap frontend tricks
PPTX
The New UI - Staying Strong with Flexbox, SASS, and {{Mustache.js}}
PPTX
Binary Studio Academy PRO. JS course. Lecture 5. Backbone plugins
PDF
Django の認証処理実装パターン / Django Authentication Patterns
PDF
WordPress&映像配信セミナー+さぶみっと!オフ会 - 第1回 さぶみっと! WEB制作セミナー Supported by NTTスマートコネクト
Souders WPO Web2.0Expo
I motion
a-blog cms 勉強会 NAGOYA 20110718
Mastering Grunt
JSConf US 2010
Web Components: What, Why, How, and When
Liferay + Wearables
Streamlining Your Applications with Web Frameworks
Taking your Web App for a walk
Create and Deploy Ember in 5 Minutes with Middleman
Just Your Type: Web Typography & You
Build a Better Editing Experience with Advanced Custom Fields - #WCTO16
Bower power
Web Application Introduction
Cheap frontend tricks
The New UI - Staying Strong with Flexbox, SASS, and {{Mustache.js}}
Binary Studio Academy PRO. JS course. Lecture 5. Backbone plugins
Django の認証処理実装パターン / Django Authentication Patterns
WordPress&映像配信セミナー+さぶみっと!オフ会 - 第1回 さぶみっと! WEB制作セミナー Supported by NTTスマートコネクト
Ad

Similar to Killer page load performance (20)

PDF
Progressive web apps
PDF
Stefan Judis "Did we(b development) lose the right direction?"
PDF
Exploring Critical Rendering Path
PDF
Optimizing web performance (Fronteers edition)
PDF
Using React for the Mobile Web
PPTX
Myths & true stories about JavaScript for SEO
PDF
How web works and browser works ? (behind the scenes)
PPTX
Shining a light on performance (js meetup)
PDF
Lessons Learned from Using Next.js in Production
PDF
Ten practical ways to improve front-end performance
PDF
Offline for web - Frontend Dev Conf Minsk 2014
PDF
Offline of web applications
PDF
Navigating the critical rendering path - Jamie Alberico - VirtuaCon
PDF
Scott Jehl - Delivering Responsibly - beyond tellerrand Düsseldorf 2015
PDF
#Webperf Choreography
PDF
Optimizing a React application for Core Web Vitals
PDF
The secret web performance metric no one is talking about
PDF
PrairieDevCon 2014 - Web Doesn't Mean Slow
PDF
Isomorphic React Applications: Performance And Scalability
PDF
20 tips for website performance
Progressive web apps
Stefan Judis "Did we(b development) lose the right direction?"
Exploring Critical Rendering Path
Optimizing web performance (Fronteers edition)
Using React for the Mobile Web
Myths & true stories about JavaScript for SEO
How web works and browser works ? (behind the scenes)
Shining a light on performance (js meetup)
Lessons Learned from Using Next.js in Production
Ten practical ways to improve front-end performance
Offline for web - Frontend Dev Conf Minsk 2014
Offline of web applications
Navigating the critical rendering path - Jamie Alberico - VirtuaCon
Scott Jehl - Delivering Responsibly - beyond tellerrand Düsseldorf 2015
#Webperf Choreography
Optimizing a React application for Core Web Vitals
The secret web performance metric no one is talking about
PrairieDevCon 2014 - Web Doesn't Mean Slow
Isomorphic React Applications: Performance And Scalability
20 tips for website performance
Ad

Recently uploaded (20)

PDF
NewMind AI Weekly Chronicles - August'25-Week II
PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
PDF
Accuracy of neural networks in brain wave diagnosis of schizophrenia
PDF
Video forgery: An extensive analysis of inter-and intra-frame manipulation al...
PDF
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
PPTX
20250228 LYD VKU AI Blended-Learning.pptx
PPTX
Group 1 Presentation -Planning and Decision Making .pptx
PDF
MIND Revenue Release Quarter 2 2025 Press Release
PPTX
Machine Learning_overview_presentation.pptx
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PDF
Spectral efficient network and resource selection model in 5G networks
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PDF
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
PDF
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PDF
Machine learning based COVID-19 study performance prediction
PDF
Electronic commerce courselecture one. Pdf
PPTX
1. Introduction to Computer Programming.pptx
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
NewMind AI Weekly Chronicles - August'25-Week II
“AI and Expert System Decision Support & Business Intelligence Systems”
Accuracy of neural networks in brain wave diagnosis of schizophrenia
Video forgery: An extensive analysis of inter-and intra-frame manipulation al...
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
20250228 LYD VKU AI Blended-Learning.pptx
Group 1 Presentation -Planning and Decision Making .pptx
MIND Revenue Release Quarter 2 2025 Press Release
Machine Learning_overview_presentation.pptx
Agricultural_Statistics_at_a_Glance_2022_0.pdf
Mobile App Security Testing_ A Comprehensive Guide.pdf
Spectral efficient network and resource selection model in 5G networks
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
Machine learning based COVID-19 study performance prediction
Electronic commerce courselecture one. Pdf
1. Introduction to Computer Programming.pptx
Per capita expenditure prediction using model stacking based on satellite ima...

Killer page load performance