SlideShare a Scribd company logo
1 of 74
Download to read offline
Frontend Performance:
Illusions & browser
rendering
Manuel Garcia
d.org/user/213194
The current situation
80-90% of the end-user response time is spent on the
frontend
http://www.stevesouders.com/blog/2012/02/10/the-performance-golden-rule/
The current situation
80-90% of the end-user response time is spent on the
frontend
But frontenders are not to blame for ALL of it.
The current situation
source: @jerontjepkema
The current situation
source: @jerontjepkema
How it works
source: @jerontjepkema
http://www.slideshare.net/MeasureWorks/measureworks-why-people-hate-to-wait-for-your-website-to-load-and-how-to-fix-that
they
So...
Not every second wasted waiting on the browser is the
frontenders fault.
Latency is a big bottleneck, especially on mobile.
What I wonโ€™t be covering:
Anything that happens on the server (gzip, varnish, memcache etc).
Anything that happens from the server to the browser.
What I will cover:
Anything that happens after the browser gets the first packet.
Outline
Brief explanation of how browsers make sense of and render our mess.
The path to the first paint - why it is important and how to get there faster.
Rendering performance - how not to shoot yourself in the foot.
Drupal - the current situation
The browser
What the browser does
Starts receiving data. First packet is about 14K.
Parses the HTML and constructs the DOM.
Starts downloading assets (images, css, js) - in the order as
they come in the HTML source code.
Parses CSS and constructs the CSSOM.
Constructs the Render Tree (DOM + CSSOM)
Calculates Layout (size & position)
Paints & composites the layers.
What the browser does
HTML - Source optimization
What the browser does
HTML - Source optimization
Prioritize content delivery - source order. (Serve first what
matters to the user)
What the browser does
HTML - Source optimization
Prioritize content delivery - source order. (Serve first what
matters to the user)
Limit and minimize assets to download (HTTP requests)
What the browser does
HTML - Source optimization
Prioritize content delivery - source order. (Serve first what
matters to the user)
Limit and minimize assets to download (HTTP requests)
Keep the number of DOM elements under control. (Divitis)
-
What the browser does
Optimizing CSSOM construction
What the browser does
Optimizing CSSOM construction
External stylesheets block rendering.
What the browser does
Optimizing CSSOM construction
External stylesheets block rendering.
Serve CSS as early as possible (in <head>)
What the browser does
Optimizing CSSOM construction
External stylesheets block rendering.
Serve CSS as early as possible (in <head>)
Avoid the use of inefficient CSS selectors (body *, #footer
h3)
What the browser does
Optimizing CSSOM construction
External stylesheets block rendering.
Serve CSS as early as possible (in <head>)
Avoid the use of inefficient CSS selectors (body *, #footer
h3)
Remove unused CSS rules. Cleanup!
-
What the browser does
Optimizing CSSOM construction - CSS selectors
Browser engines evaluate each rule from right to left,
starting from the rightmost selector (called the "key") and
moving through each selector until it finds a match or
discards the rule.
https://developer.mozilla.org/en-US/docs/Web/Guide/CSS/Writing_efficient_CSS
What the browser does
Optimizing CSSOM construction - CSS selectors
Avoid a universal key selector: * Allow elements to inherit from
ancestors, or use a class to apply a style to multiple elements.
What the browser does
Optimizing CSSOM construction - CSS selectors
Avoid a universal key selector: * Allow elements to inherit from
ancestors, or use a class to apply a style to multiple elements.
Make your rules as specific as possible. Prefer class and ID
selectors over tag selectors.
What the browser does
Optimizing CSSOM construction - CSS selectors
Avoid a universal key selector: * Allow elements to inherit from
ancestors, or use a class to apply a style to multiple elements.
Make your rules as specific as possible. Prefer class and ID
selectors over tag selectors.
Remove redundant qualifiers.
ID selectors qualified by class and/or tag selectors
Class selectors qualified by tag selectors
What the browser does
Optimizing CSSOM construction - CSS selectors
Avoid a universal key selector: * Allow elements to inherit from
ancestors, or use a class to apply a style to multiple elements.
Make your rules as specific as possible. Prefer class and ID
selectors over tag selectors.
Remove redundant qualifiers.
ID selectors qualified by class and/or tag selectors
Class selectors qualified by tag selectors
4. Use class selectors instead of descendant selectors.
What the browser does
And what about Javascript?
What the browser does
And what about Javascript?
Because it can change the DOM and the CSSDOM, when the browser sees a
<script> tag it will block downloading of other assets until the js file has been
downloaded and executed.
What the browser does
source: (Building Faster Websites: Crash Course on Web Performance, Fluent 2013)
What the browser does
Javascript:
Avoid it if not necessary.
What the browser does
Javascript:
Avoid it if not necessary.
Inline it in <head> if necessary for above the fold, if it is small, and you are
NOT changing the DOM or CSSOM.
What the browser does
Javascript:
Avoid it if not necessary.
Inline it in <head> if necessary for above the fold, if it is small, and you are
NOT changing the DOM or CSSOM.
Normally just place it at the bottom of the page.
What the browser does
Javascript:
Avoid it if not necessary.
Inline it in <head> if necessary for above the fold, if it is small, and you are
NOT changing the DOM or CSSOM.
Normally just place it at the bottom of the page.
And/or defer it: <script async src="progressively-enhancing.js">
-
The path to first paint
t
The path to first paint
Make it here fast
Make it count!
The path to first paint
Itโ€™s what your users first see.
Itโ€™s what the user is stuck with on mobile while waiting to load your 10^6 assets.
First paint should be a styled version without JS of your
website.
It should be functional, which is especially important on
slow/unstable connections and old devices. Impacts UX!
The fastest first paint would be a flash of unstyled content, if CSS is placed at the end of the page.
If the browser has the page title, and shows white screen for seconds long, you have work to do.
The path to first paint
source: @jerontjepkema
http://www.slideshare.net/MeasureWorks/measureworks-why-people-hate-to-wait-for-...
The path to first paint
How to avoid delaying the first paint
1. Do NOT put external JS in the header.
The path to first paint
How to avoid delaying the first paint
1. Do NOT put external JS in the header.
2. Prioritize delivery of critical content & assets.
The path to first paint
How to avoid delaying the first paint
1. Do NOT put external JS in the header.
2. Prioritize delivery of critical content & assets.
3. Minimize the number of assets to download (reduces latency impact).
The path to first paint
How to avoid delaying the first paint
1. Do NOT put external JS in the header.
2. Prioritize delivery of critical content & assets.
3. Minimize the number of assets to download (reduces latency impact).
4. Minimize the size of assets to download.
The path to first paint
How to avoid delaying the first paint
1. Do NOT put external JS in the header.
2. Prioritize delivery of critical content & assets.
3. Minimize the number of assets to download (reduces latency impact).
4. Minimize the size of assets to download.
5. Optimize DOM generation.
The path to first paint
How to avoid delaying the first paint
1. Do NOT put external JS in the header
2. Prioritize delivery of critical content & assets
3. Minimize the number of assets to download (reduces latency impact).
4. Minimize the size of assets to download.
5. Optimize DOM generation.
6. Optimize CSSOM generation.
The path to first paint
How to avoid delaying the first paint
1. Do NOT put external JS in the header
2. Prioritize delivery of critical content & assets
3. Minimize the number of assets to download (reduces latency impact).
4. Minimize the size of assets to download.
5. Optimize DOM generation.
6. Optimize CSSOM generation.
7. Put Ads and other 3rd party nastiness as low in the source code as
possible.
The path to first paint
Already useful / useable
View full test: http://www.webpagetest.org/video/compare.php?tests=140515_0K_NNE-r%3A1-c%
3A0&thumbSize=150&ival=100&end=full
Website tested: www.deotramanera.co (Drupal 7)
The path to first paint
BONUS: rendering
performance++
View full test: http://www.webpagetest.org/video/compare.php?tests=140515_0K_NNE-r%3A1-c%
3A0&thumbSize=150&ival=100&end=full
Website tested: www.deotramanera.co (Drupal 7)
The path to first paint
Some general recommendations
โ— First rendered frame should contain element positioning and dimensions.
โ— Style with disabled JS, as if it was ready to be used (Bonus: Your site will
not crumble when your JS breaks.) Use NoScript or similar.
โ— The browser uses your CSS, not your SASS file. Try not to nest too much.
The path to first paint
Some general recommendations
โ— First rendered frame should contain element positioning and dimensions.
โ— Style with disabled JS, as if it was ready to be used (Bonus: Your site will
not crumble when your JS breaks.) Use NoScript or similar.
โ— The browser uses your CSS, not your SASS file. Try not to nest too much.
Dangers to our render times outside our control:
โ— Ads - Get them out of the first paint path. They should not hurt UX.
โ— Bad content writing habits (too many iframes, embedded crap) - educate
your content creators and/or remove the tags through input filters.
Rendering performance
Rendering performance
The ability for the browser to render composited images fast enough so that it can
actually give you at least 25 fps while using the site.
You put effort into first paint, do not throw it all away after the fact.
Keep your site snappy to use!
Rendering performance
The ability for the browser to render composited images fast enough so that it can
actually give you at least 25 fps while using the site.
You put effort into first paint, do not throw it all away after the fact.
Keep your site snappy to use!
What hurts the render pipeline?
โ— Things that invalidate the DOM
Rendering performance
The ability for the browser to render composited images fast enough so that it can
actually give you at least 25 fps while using the site.
You put effort into first paint, do not throw it all away after the fact.
Keep your site snappy to use!
What hurts the render pipeline?
โ— Things that invalidate the DOM
โ— Things that invalidate the CSSOM
Rendering performance
The ability for the browser to render composited images fast enough so that it can
actually give you at least 25 fps while using the site.
You put effort into first paint, do not throw it all away after the fact.
Keep your site snappy to use!
What hurts the render pipeline?
โ— Things that invalidate the DOM
โ— Things that invalidate the CSSOM
โ— JS animations (use requestAnimationFrame, not jQuery.animate)
โ— Flash
โ— Ads
โ— ...
Rendering performance
Things that hurt the render pipeline (in-app):
โ— Adding/removing/changing HTML elements.
โ— Adding/removing CSS classes, adding inline styles.
โ— Showing / hiding elements.
These cause the browser to invalidate the render tree / layout. It means doing a bunch of expensive
things, and if the recalculation gets big and/or gets very frequent, you could lose frames, which results in
shuttering etc.
If possible, provide the markup for your JS goodies in the original source code.
If you get the first paint right,
you have most of the job done,
donโ€™t mess things up!
Drupal
Drupal
Getting Drupal (7) to render fast
Minifying and aggregation of CSS and JS:
โ— Advanced CSS/JS Aggregation (more features)
โ— Speedy (minified versions of core JavaScript)
โ— Simple aggregation (reduces the number of aggregated files)
Drupal
Getting Drupal (7) to render fast
Minifying and aggregation of CSS and JS:
โ— Advanced CSS/JS Aggregation (more features)
โ— Speedy (minified versions of core JavaScript)
โ— Simple aggregation (reduces the number of aggregated files)
Reduce the number of DOM elements:
โ— Fences (leaner markup for fields)
โ— Entity view modes
โ— Display Suite
โ— Optimize your page.tpl, panels tpls, etc
Use the minimum number of elements necessary
Drupal
Getting Drupal (7) to render fast
Reduce the amount of CSS
/**
* Implement hook_css_alter().
*/
function MYTHEME_css_alter(&$css) {
// Remove a single css file.
unset($css[drupal_get_path('module', 'system') . '/defaults.css']);
}
Drupal
Getting Drupal (7) to render fast
Reduce the amount of CSS
/**
* Implement hook_css_alter().
*/
function MYTHEME_css_alter(&$css) {
// remove all core css files
foreach ($css as $key => $file) {
if (preg_match('/^modules/', $key)) {
unset($css[$key]);
}
}
}
Drupal
Getting Drupal (7) to render fast
Reduce the amount of CSS
/**
* Implement hook_css_alter().
*/
function MYTHEME_css_alter(&$css) {
// Remove all but my theme's css files
$theme_path = drupal_get_path('theme', 'MYTHEME');
$string_match = '/^'. str_replace('/', '/', $theme_path) .'/';
foreach ($css as $key => $file) {
if (!preg_match($string_match, $key)) {
unset($css[$key]);
}
}
}
Drupal
Getting Drupal (7) to render fast
async Javascript (D7, done in D8!):
Needs backport: #1140356 OR #1664602
Drupal
Getting Drupal (7) to render fast
async Javascript (D7, done in D8!):
Needs backport: #1140356 OR #1664602
โ— advagg 7.x-2.6 does it without need to patch core
โ— aloha does it in template.php (a bit nasty)
Drupal
Getting Drupal (7) to render fast
async Javascript (D7, done in D8!):
aloha does it in hook_process_html():
function aloha_process_html(&$variables) {
if (strpos($variables['scripts'], '/lib/aloha.js') !== FALSE) {
$variables['scripts'] = preg_replace('/(/lib/aloha.js[^"]*["])
/', '$1 data-aloha-defer-init="true"', $variables['scripts'], 1);
}
}
Drupal
Getting Drupal (7) to render fast
Moving all JS to the footer:
/**
* Implements hook_js_alter().
*/
function MYTHEME_js_alter(&&javascript) {
// Move all JS to the footer.
foreach ($javascript as $name => $script) {
$javascript[$name]['scope'] = 'footer';
}
// Forces Modernizr to header if the module is enabled.
if (module_exists('modernizer')) {
$javascript[modernizer_get_path()]['scope'] = 'header';
}
}
Drupal
Getting Drupal (7) to render fast
Getting rid of ALL Javascript:
/**
* Implements hook_js_alter().
*/
function MYTHEME_js_alter(&$javascript) {
// Remove all JS
$javascript = array(); // 0_o
}
Drupal
And what about Drupal 8? (pull from 16-mar-2014)
Out of the box, front page:
Drupal
And what about Drupal 8? (pull from 16-mar-2014)
Out of the box, front page:
โ— CSS & JS aggregation on by default - WIN!
Drupal
And what about Drupal 8? (pull from 16-mar-2014)
Out of the box, front page:
โ— CSS & JS aggregation on by default - WIN!
โ— 4 CSS files for anonymous, 7 for admin. CSS in <head>.
Drupal
And what about Drupal 8? (pull from 16-mar-2014)
Out of the box, front page:
โ— CSS & JS aggregation on by default - WIN!
โ— 4 CSS files for anonymous, 7 for admin. CSS in <head>.
โ— JS is in <head> & not async by default :(
Drupal
And what about Drupal 8? (pull from 16-mar-2014)
Out of the box, front page:
โ— CSS & JS aggregation on by default - WIN!
โ— 4 CSS files for anonymous, 7 for admin. CSS in <head>.
โ— JS is in <head> & not async by default :(
โ— First paint at ~400ms for admin, ~200ms for anonymous.
Drupal
And what about Drupal 8? (pull from 16-mar-2014)
Out of the box, front page:
โ— CSS & JS aggregation on by default - WIN!
โ— 4 CSS files for anonymous, 7 for admin. CSS in <head>.
โ— JS is in <head> & not async by default :(
โ— First paint at ~400ms for admin, ~200ms for anonymous.
โ—‹ With JS at the bottom, first paint as admin goes down
to ~200ms!
Drupal
And what about Drupal 8? (pull from 16-mar-2014)
Out of the box, front page:
โ— CSS & JS aggregation on by default - WIN!
โ— 4 CSS files for anonymous, 7 for admin. CSS in <head>.
โ— JS is in <head> & not async by default :(
โ— First paint at ~400ms for admin, ~200ms for anonymous.
โ—‹ With JS at the bottom, first paint as admin goes down
to ~200ms!
โ— In-app paint time is 2-5ms for anonymous, 4-6ms for
admin - pretty good, but its an empty page ;)
Drupal
And what about Drupal 8?
It is a lot better than 7.x
We only provide the JS needed for each page - WIN!
Workโ€™s still being done - tag: frontend performance
Get involved:
โ— [Meta] selectors clean-up #1574470
โ— jQuery and Drupal JavaScript libraries and settings are
output even when no JS is added to the page #1279226
โ— [META] Improving CSS and JS preprocessing #1490312
Tools & Resources
Tools
โ— Webpagetest: http://www.webpagetest.org/
โ— Firefox & Chrome dev tools
โ— Google PageSpeed insights: http://developers.google.
com/speed/pagespeed/insights/
Further reading, sources and resources
โ— Performance profiling with the Timeline: https://developer.chrome.com/devtools/docs/timeline
โ— https://developers.google.com/speed/
โ— http://www.stevesouders.com/blog/
โ— https://www.igvita.com/
โ— On Layout & Web Performance http://www.kellegous.com/j/2013/01/26/layout-performance/
โ— Writing efficient CSS https://developer.mozilla.org/en-US/docs/Web/Guide/CSS/Writing_efficient_CSS
โ— Best Practices for Speeding Up Your Web Site https://developer.yahoo.com/performance/rules.html
โ— Profiling CSS for fun and profit http://perfectionkills.com/profiling-css-for-fun-and-profit-optimization-notes/
Thanks!
Manuel Garcia
d.org/user/213194

More Related Content

What's hot

jQuery For Beginners - jQuery Conference 2009
jQuery For Beginners - jQuery Conference 2009jQuery For Beginners - jQuery Conference 2009
jQuery For Beginners - jQuery Conference 2009Ralph Whitbeck
ย 
Multimedia on the web - HTML5 video and audio
Multimedia on the web - HTML5 video and audioMultimedia on the web - HTML5 video and audio
Multimedia on the web - HTML5 video and audioChristian Heilmann
ย 
HTML5 and CSS3 Techniques You Can Use Today
HTML5 and CSS3 Techniques You Can Use TodayHTML5 and CSS3 Techniques You Can Use Today
HTML5 and CSS3 Techniques You Can Use TodayTodd Anglin
ย 
WordPress Standardized Loop API
WordPress Standardized Loop APIWordPress Standardized Loop API
WordPress Standardized Loop APIChris Jean
ย 
Html5 Overview
Html5 OverviewHtml5 Overview
Html5 OverviewOwen Williams
ย 
It's a Mod World - A Practical Guide to Rocking Modernizr
It's a Mod World - A Practical Guide to Rocking ModernizrIt's a Mod World - A Practical Guide to Rocking Modernizr
It's a Mod World - A Practical Guide to Rocking ModernizrMichael Enslow
ย 
How Not To Code Flex Applications
How Not To Code Flex ApplicationsHow Not To Code Flex Applications
How Not To Code Flex Applicationsjeff tapper
ย 
AngularJS for Legacy Apps
AngularJS for Legacy AppsAngularJS for Legacy Apps
AngularJS for Legacy AppsPeter Drinnan
ย 
Mobile Web Speed Bumps
Mobile Web Speed BumpsMobile Web Speed Bumps
Mobile Web Speed BumpsNicholas Zakas
ย 
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
ย 
HTML5: An Overview
HTML5: An OverviewHTML5: An Overview
HTML5: An OverviewNagendra Um
ย 
Tek 2013 - Building Web Apps from a New Angle with AngularJS
Tek 2013 - Building Web Apps from a New Angle with AngularJSTek 2013 - Building Web Apps from a New Angle with AngularJS
Tek 2013 - Building Web Apps from a New Angle with AngularJSPablo Godel
ย 
HTML5@็”ตๅญๅ•†ๅŠก.com
HTML5@็”ตๅญๅ•†ๅŠก.comHTML5@็”ตๅญๅ•†ๅŠก.com
HTML5@็”ตๅญๅ•†ๅŠก.comkaven yan
ย 
Rey Bango - HTML5: polyfills and shims
Rey Bango -  HTML5: polyfills and shimsRey Bango -  HTML5: polyfills and shims
Rey Bango - HTML5: polyfills and shimsStarTech Conference
ย 
[In Control 2010] HTML5
[In Control 2010] HTML5[In Control 2010] HTML5
[In Control 2010] HTML5Christopher Schmitt
ย 
Prebrowsing - Velocity NY 2013
Prebrowsing - Velocity NY 2013Prebrowsing - Velocity NY 2013
Prebrowsing - Velocity NY 2013Steve Souders
ย 
High Performance JavaScript (Amazon DevCon 2011)
High Performance JavaScript (Amazon DevCon 2011)High Performance JavaScript (Amazon DevCon 2011)
High Performance JavaScript (Amazon DevCon 2011)Nicholas Zakas
ย 
@media - Even Faster Web Sites
@media - Even Faster Web Sites@media - Even Faster Web Sites
@media - Even Faster Web SitesSteve Souders
ย 

What's hot (20)

jQuery For Beginners - jQuery Conference 2009
jQuery For Beginners - jQuery Conference 2009jQuery For Beginners - jQuery Conference 2009
jQuery For Beginners - jQuery Conference 2009
ย 
Multimedia on the web - HTML5 video and audio
Multimedia on the web - HTML5 video and audioMultimedia on the web - HTML5 video and audio
Multimedia on the web - HTML5 video and audio
ย 
Using HTML5 sensibly
Using HTML5 sensiblyUsing HTML5 sensibly
Using HTML5 sensibly
ย 
HTML5 and CSS3 Techniques You Can Use Today
HTML5 and CSS3 Techniques You Can Use TodayHTML5 and CSS3 Techniques You Can Use Today
HTML5 and CSS3 Techniques You Can Use Today
ย 
WordPress Standardized Loop API
WordPress Standardized Loop APIWordPress Standardized Loop API
WordPress Standardized Loop API
ย 
Html5 Overview
Html5 OverviewHtml5 Overview
Html5 Overview
ย 
It's a Mod World - A Practical Guide to Rocking Modernizr
It's a Mod World - A Practical Guide to Rocking ModernizrIt's a Mod World - A Practical Guide to Rocking Modernizr
It's a Mod World - A Practical Guide to Rocking Modernizr
ย 
How Not To Code Flex Applications
How Not To Code Flex ApplicationsHow Not To Code Flex Applications
How Not To Code Flex Applications
ย 
AngularJS for Legacy Apps
AngularJS for Legacy AppsAngularJS for Legacy Apps
AngularJS for Legacy Apps
ย 
Lecture 3 Javascript1
Lecture 3  Javascript1Lecture 3  Javascript1
Lecture 3 Javascript1
ย 
Mobile Web Speed Bumps
Mobile Web Speed BumpsMobile Web Speed Bumps
Mobile Web Speed Bumps
ย 
Progressive Enhancement 2.0 (Conference Agnostic)
Progressive Enhancement 2.0 (Conference Agnostic)Progressive Enhancement 2.0 (Conference Agnostic)
Progressive Enhancement 2.0 (Conference Agnostic)
ย 
HTML5: An Overview
HTML5: An OverviewHTML5: An Overview
HTML5: An Overview
ย 
Tek 2013 - Building Web Apps from a New Angle with AngularJS
Tek 2013 - Building Web Apps from a New Angle with AngularJSTek 2013 - Building Web Apps from a New Angle with AngularJS
Tek 2013 - Building Web Apps from a New Angle with AngularJS
ย 
HTML5@็”ตๅญๅ•†ๅŠก.com
HTML5@็”ตๅญๅ•†ๅŠก.comHTML5@็”ตๅญๅ•†ๅŠก.com
HTML5@็”ตๅญๅ•†ๅŠก.com
ย 
Rey Bango - HTML5: polyfills and shims
Rey Bango -  HTML5: polyfills and shimsRey Bango -  HTML5: polyfills and shims
Rey Bango - HTML5: polyfills and shims
ย 
[In Control 2010] HTML5
[In Control 2010] HTML5[In Control 2010] HTML5
[In Control 2010] HTML5
ย 
Prebrowsing - Velocity NY 2013
Prebrowsing - Velocity NY 2013Prebrowsing - Velocity NY 2013
Prebrowsing - Velocity NY 2013
ย 
High Performance JavaScript (Amazon DevCon 2011)
High Performance JavaScript (Amazon DevCon 2011)High Performance JavaScript (Amazon DevCon 2011)
High Performance JavaScript (Amazon DevCon 2011)
ย 
@media - Even Faster Web Sites
@media - Even Faster Web Sites@media - Even Faster Web Sites
@media - Even Faster Web Sites
ย 

Similar to Frontend Performance: Illusions & browser rendering

Using a CSS Framework
Using a CSS FrameworkUsing a CSS Framework
Using a CSS FrameworkGareth Saunders
ย 
Even faster web sites presentation 3
Even faster web sites presentation 3Even faster web sites presentation 3
Even faster web sites presentation 3Felipe Lavรญn
ย 
Building high performing web pages
Building high performing web pagesBuilding high performing web pages
Building high performing web pagesNilesh Bafna
ย 
DrupalCampLA 2011 - Drupal frontend-optimizing
DrupalCampLA 2011 - Drupal frontend-optimizingDrupalCampLA 2011 - Drupal frontend-optimizing
DrupalCampLA 2011 - Drupal frontend-optimizingAshok Modi
ย 
implement lighthouse-ci with your web development workflow
implement lighthouse-ci with your web development workflowimplement lighthouse-ci with your web development workflow
implement lighthouse-ci with your web development workflowWordPress
ย 
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
ย 
Client Side Performance @ Xero
Client Side Performance @ XeroClient Side Performance @ Xero
Client Side Performance @ XeroCraig Walker
ย 
EdTechJoker Spring 2020 - Lecture 4 - HTML
EdTechJoker Spring 2020 - Lecture 4 - HTMLEdTechJoker Spring 2020 - Lecture 4 - HTML
EdTechJoker Spring 2020 - Lecture 4 - HTMLBryan Ollendyke
ย 
Navigating the critical rendering path - Jamie Alberico - VirtuaCon
Navigating the critical rendering path -  Jamie Alberico - VirtuaConNavigating the critical rendering path -  Jamie Alberico - VirtuaCon
Navigating the critical rendering path - Jamie Alberico - VirtuaConJamie Indigo
ย 
Drupal Frontend Performance and Scalability
Drupal Frontend Performance and ScalabilityDrupal Frontend Performance and Scalability
Drupal Frontend Performance and ScalabilityAshok Modi
ย 
KharkivJS: Flaws of the Web Components in 2019 and how to address them
KharkivJS: Flaws of the Web Components in 2019 and how to address themKharkivJS: Flaws of the Web Components in 2019 and how to address them
KharkivJS: Flaws of the Web Components in 2019 and how to address themVlad Fedosov
ย 
AMP - SMX Mรผnchen 2018
AMP - SMX Mรผnchen 2018AMP - SMX Mรผnchen 2018
AMP - SMX Mรผnchen 2018Bastian Grimm
ย 
Please dont touch-3.6-jsday
Please dont touch-3.6-jsdayPlease dont touch-3.6-jsday
Please dont touch-3.6-jsdayFrancesco Fullone
ย 
High Performance Web Sites, With Ads: Don't let third parties make you slow
High Performance Web Sites, With Ads: Don't let third parties make you slowHigh Performance Web Sites, With Ads: Don't let third parties make you slow
High Performance Web Sites, With Ads: Don't let third parties make you slowTobias Jรคrlund
ย 
Performance as User Experience [AEADC 2018]
Performance as User Experience [AEADC 2018]Performance as User Experience [AEADC 2018]
Performance as User Experience [AEADC 2018]Aaron Gustafson
ย 
YGLF 2015 - Boom Performance | Eran Zinman (daPulse)
YGLF 2015 -  Boom Performance | Eran Zinman (daPulse)YGLF 2015 -  Boom Performance | Eran Zinman (daPulse)
YGLF 2015 - Boom Performance | Eran Zinman (daPulse)Eran Zinman
ย 
BOOM Performance
BOOM PerformanceBOOM Performance
BOOM Performancedapulse
ย 
Exploring Critical Rendering Path
Exploring Critical Rendering PathExploring Critical Rendering Path
Exploring Critical Rendering PathRaphael Amorim
ย 
Killing the Angle Bracket
Killing the Angle BracketKilling the Angle Bracket
Killing the Angle Bracketjnewmanux
ย 
Implementation of gui framework part2
Implementation of gui framework part2Implementation of gui framework part2
Implementation of gui framework part2masahiroookubo
ย 

Similar to Frontend Performance: Illusions & browser rendering (20)

Using a CSS Framework
Using a CSS FrameworkUsing a CSS Framework
Using a CSS Framework
ย 
Even faster web sites presentation 3
Even faster web sites presentation 3Even faster web sites presentation 3
Even faster web sites presentation 3
ย 
Building high performing web pages
Building high performing web pagesBuilding high performing web pages
Building high performing web pages
ย 
DrupalCampLA 2011 - Drupal frontend-optimizing
DrupalCampLA 2011 - Drupal frontend-optimizingDrupalCampLA 2011 - Drupal frontend-optimizing
DrupalCampLA 2011 - Drupal frontend-optimizing
ย 
implement lighthouse-ci with your web development workflow
implement lighthouse-ci with your web development workflowimplement lighthouse-ci with your web development workflow
implement lighthouse-ci with your web development workflow
ย 
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
ย 
Client Side Performance @ Xero
Client Side Performance @ XeroClient Side Performance @ Xero
Client Side Performance @ Xero
ย 
EdTechJoker Spring 2020 - Lecture 4 - HTML
EdTechJoker Spring 2020 - Lecture 4 - HTMLEdTechJoker Spring 2020 - Lecture 4 - HTML
EdTechJoker Spring 2020 - Lecture 4 - HTML
ย 
Navigating the critical rendering path - Jamie Alberico - VirtuaCon
Navigating the critical rendering path -  Jamie Alberico - VirtuaConNavigating the critical rendering path -  Jamie Alberico - VirtuaCon
Navigating the critical rendering path - Jamie Alberico - VirtuaCon
ย 
Drupal Frontend Performance and Scalability
Drupal Frontend Performance and ScalabilityDrupal Frontend Performance and Scalability
Drupal Frontend Performance and Scalability
ย 
KharkivJS: Flaws of the Web Components in 2019 and how to address them
KharkivJS: Flaws of the Web Components in 2019 and how to address themKharkivJS: Flaws of the Web Components in 2019 and how to address them
KharkivJS: Flaws of the Web Components in 2019 and how to address them
ย 
AMP - SMX Mรผnchen 2018
AMP - SMX Mรผnchen 2018AMP - SMX Mรผnchen 2018
AMP - SMX Mรผnchen 2018
ย 
Please dont touch-3.6-jsday
Please dont touch-3.6-jsdayPlease dont touch-3.6-jsday
Please dont touch-3.6-jsday
ย 
High Performance Web Sites, With Ads: Don't let third parties make you slow
High Performance Web Sites, With Ads: Don't let third parties make you slowHigh Performance Web Sites, With Ads: Don't let third parties make you slow
High Performance Web Sites, With Ads: Don't let third parties make you slow
ย 
Performance as User Experience [AEADC 2018]
Performance as User Experience [AEADC 2018]Performance as User Experience [AEADC 2018]
Performance as User Experience [AEADC 2018]
ย 
YGLF 2015 - Boom Performance | Eran Zinman (daPulse)
YGLF 2015 -  Boom Performance | Eran Zinman (daPulse)YGLF 2015 -  Boom Performance | Eran Zinman (daPulse)
YGLF 2015 - Boom Performance | Eran Zinman (daPulse)
ย 
BOOM Performance
BOOM PerformanceBOOM Performance
BOOM Performance
ย 
Exploring Critical Rendering Path
Exploring Critical Rendering PathExploring Critical Rendering Path
Exploring Critical Rendering Path
ย 
Killing the Angle Bracket
Killing the Angle BracketKilling the Angle Bracket
Killing the Angle Bracket
ย 
Implementation of gui framework part2
Implementation of gui framework part2Implementation of gui framework part2
Implementation of gui framework part2
ย 

Recently uploaded

VIP Model Call Girls NIBM ( Pune ) Call ON 8005736733 Starting From 5K to 25K...
VIP Model Call Girls NIBM ( Pune ) Call ON 8005736733 Starting From 5K to 25K...VIP Model Call Girls NIBM ( Pune ) Call ON 8005736733 Starting From 5K to 25K...
VIP Model Call Girls NIBM ( Pune ) Call ON 8005736733 Starting From 5K to 25K...SUHANI PANDEY
ย 
Call Girls Ludhiana Just Call 98765-12871 Top Class Call Girl Service Available
Call Girls Ludhiana Just Call 98765-12871 Top Class Call Girl Service AvailableCall Girls Ludhiana Just Call 98765-12871 Top Class Call Girl Service Available
Call Girls Ludhiana Just Call 98765-12871 Top Class Call Girl Service AvailableSeo
ย 
Sarola * Female Escorts Service in Pune | 8005736733 Independent Escorts & Da...
Sarola * Female Escorts Service in Pune | 8005736733 Independent Escorts & Da...Sarola * Female Escorts Service in Pune | 8005736733 Independent Escorts & Da...
Sarola * Female Escorts Service in Pune | 8005736733 Independent Escorts & Da...SUHANI PANDEY
ย 
Pune Airport ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready...
Pune Airport ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready...Pune Airport ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready...
Pune Airport ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready...tanu pandey
ย 
Top Rated Pune Call Girls Daund โŸŸ 6297143586 โŸŸ Call Me For Genuine Sex Servi...
Top Rated  Pune Call Girls Daund โŸŸ 6297143586 โŸŸ Call Me For Genuine Sex Servi...Top Rated  Pune Call Girls Daund โŸŸ 6297143586 โŸŸ Call Me For Genuine Sex Servi...
Top Rated Pune Call Girls Daund โŸŸ 6297143586 โŸŸ Call Me For Genuine Sex Servi...Call Girls in Nagpur High Profile
ย 
All Time Service Available Call Girls Mg Road ๐Ÿ‘Œ โญ๏ธ 6378878445
All Time Service Available Call Girls Mg Road ๐Ÿ‘Œ โญ๏ธ 6378878445All Time Service Available Call Girls Mg Road ๐Ÿ‘Œ โญ๏ธ 6378878445
All Time Service Available Call Girls Mg Road ๐Ÿ‘Œ โญ๏ธ 6378878445ruhi
ย 
( Pune ) VIP Pimpri Chinchwad Call Girls ๐ŸŽ—๏ธ 9352988975 Sizzling | Escorts | G...
( Pune ) VIP Pimpri Chinchwad Call Girls ๐ŸŽ—๏ธ 9352988975 Sizzling | Escorts | G...( Pune ) VIP Pimpri Chinchwad Call Girls ๐ŸŽ—๏ธ 9352988975 Sizzling | Escorts | G...
( Pune ) VIP Pimpri Chinchwad Call Girls ๐ŸŽ—๏ธ 9352988975 Sizzling | Escorts | G...nilamkumrai
ย 
Shikrapur - Call Girls in Pune Neha 8005736733 | 100% Gennuine High Class Ind...
Shikrapur - Call Girls in Pune Neha 8005736733 | 100% Gennuine High Class Ind...Shikrapur - Call Girls in Pune Neha 8005736733 | 100% Gennuine High Class Ind...
Shikrapur - Call Girls in Pune Neha 8005736733 | 100% Gennuine High Class Ind...SUHANI PANDEY
ย 
WhatsApp ๐Ÿ“ž 8448380779 โœ…Call Girls In Mamura Sector 66 ( Noida)
WhatsApp ๐Ÿ“ž 8448380779 โœ…Call Girls In Mamura Sector 66 ( Noida)WhatsApp ๐Ÿ“ž 8448380779 โœ…Call Girls In Mamura Sector 66 ( Noida)
WhatsApp ๐Ÿ“ž 8448380779 โœ…Call Girls In Mamura Sector 66 ( Noida)Delhi Call girls
ย 
Dubai=Desi Dubai Call Girls O525547819 Outdoor Call Girls Dubai
Dubai=Desi Dubai Call Girls O525547819 Outdoor Call Girls DubaiDubai=Desi Dubai Call Girls O525547819 Outdoor Call Girls Dubai
Dubai=Desi Dubai Call Girls O525547819 Outdoor Call Girls Dubaikojalkojal131
ย 
20240508 QFM014 Elixir Reading List April 2024.pdf
20240508 QFM014 Elixir Reading List April 2024.pdf20240508 QFM014 Elixir Reading List April 2024.pdf
20240508 QFM014 Elixir Reading List April 2024.pdfMatthew Sinclair
ย 
Katraj ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready For S...
Katraj ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready For S...Katraj ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready For S...
Katraj ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready For S...tanu pandey
ย 
Hireโ† Young Call Girls in Tilak nagar (Delhi) โ˜Ž๏ธ 9205541914 โ˜Ž๏ธ Independent Esc...
Hireโ† Young Call Girls in Tilak nagar (Delhi) โ˜Ž๏ธ 9205541914 โ˜Ž๏ธ Independent Esc...Hireโ† Young Call Girls in Tilak nagar (Delhi) โ˜Ž๏ธ 9205541914 โ˜Ž๏ธ Independent Esc...
Hireโ† Young Call Girls in Tilak nagar (Delhi) โ˜Ž๏ธ 9205541914 โ˜Ž๏ธ Independent Esc...Delhi Call girls
ย 
APNIC Updates presented by Paul Wilson at ARIN 53
APNIC Updates presented by Paul Wilson at ARIN 53APNIC Updates presented by Paul Wilson at ARIN 53
APNIC Updates presented by Paul Wilson at ARIN 53APNIC
ย 
Al Barsha Night Partner +0567686026 Call Girls Dubai
Al Barsha Night Partner +0567686026 Call Girls  DubaiAl Barsha Night Partner +0567686026 Call Girls  Dubai
Al Barsha Night Partner +0567686026 Call Girls DubaiEscorts Call Girls
ย 
(+971568250507 ))# Young Call Girls in Ajman By Pakistani Call Girls in ...
(+971568250507  ))#  Young Call Girls  in Ajman  By Pakistani Call Girls  in ...(+971568250507  ))#  Young Call Girls  in Ajman  By Pakistani Call Girls  in ...
(+971568250507 ))# Young Call Girls in Ajman By Pakistani Call Girls in ...Escorts Call Girls
ย 
๐Ÿ’š๐Ÿ˜‹ Bilaspur Escort Service Call Girls, 9352852248 โ‚น5000 To 25K With AC๐Ÿ’š๐Ÿ˜‹
๐Ÿ’š๐Ÿ˜‹ Bilaspur Escort Service Call Girls, 9352852248 โ‚น5000 To 25K With AC๐Ÿ’š๐Ÿ˜‹๐Ÿ’š๐Ÿ˜‹ Bilaspur Escort Service Call Girls, 9352852248 โ‚น5000 To 25K With AC๐Ÿ’š๐Ÿ˜‹
๐Ÿ’š๐Ÿ˜‹ Bilaspur Escort Service Call Girls, 9352852248 โ‚น5000 To 25K With AC๐Ÿ’š๐Ÿ˜‹nirzagarg
ย 

Recently uploaded (20)

VIP Model Call Girls NIBM ( Pune ) Call ON 8005736733 Starting From 5K to 25K...
VIP Model Call Girls NIBM ( Pune ) Call ON 8005736733 Starting From 5K to 25K...VIP Model Call Girls NIBM ( Pune ) Call ON 8005736733 Starting From 5K to 25K...
VIP Model Call Girls NIBM ( Pune ) Call ON 8005736733 Starting From 5K to 25K...
ย 
6.High Profile Call Girls In Punjab +919053900678 Punjab Call GirlHigh Profil...
6.High Profile Call Girls In Punjab +919053900678 Punjab Call GirlHigh Profil...6.High Profile Call Girls In Punjab +919053900678 Punjab Call GirlHigh Profil...
6.High Profile Call Girls In Punjab +919053900678 Punjab Call GirlHigh Profil...
ย 
Call Girls Ludhiana Just Call 98765-12871 Top Class Call Girl Service Available
Call Girls Ludhiana Just Call 98765-12871 Top Class Call Girl Service AvailableCall Girls Ludhiana Just Call 98765-12871 Top Class Call Girl Service Available
Call Girls Ludhiana Just Call 98765-12871 Top Class Call Girl Service Available
ย 
Sarola * Female Escorts Service in Pune | 8005736733 Independent Escorts & Da...
Sarola * Female Escorts Service in Pune | 8005736733 Independent Escorts & Da...Sarola * Female Escorts Service in Pune | 8005736733 Independent Escorts & Da...
Sarola * Female Escorts Service in Pune | 8005736733 Independent Escorts & Da...
ย 
Pune Airport ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready...
Pune Airport ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready...Pune Airport ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready...
Pune Airport ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready...
ย 
Top Rated Pune Call Girls Daund โŸŸ 6297143586 โŸŸ Call Me For Genuine Sex Servi...
Top Rated  Pune Call Girls Daund โŸŸ 6297143586 โŸŸ Call Me For Genuine Sex Servi...Top Rated  Pune Call Girls Daund โŸŸ 6297143586 โŸŸ Call Me For Genuine Sex Servi...
Top Rated Pune Call Girls Daund โŸŸ 6297143586 โŸŸ Call Me For Genuine Sex Servi...
ย 
All Time Service Available Call Girls Mg Road ๐Ÿ‘Œ โญ๏ธ 6378878445
All Time Service Available Call Girls Mg Road ๐Ÿ‘Œ โญ๏ธ 6378878445All Time Service Available Call Girls Mg Road ๐Ÿ‘Œ โญ๏ธ 6378878445
All Time Service Available Call Girls Mg Road ๐Ÿ‘Œ โญ๏ธ 6378878445
ย 
( Pune ) VIP Pimpri Chinchwad Call Girls ๐ŸŽ—๏ธ 9352988975 Sizzling | Escorts | G...
( Pune ) VIP Pimpri Chinchwad Call Girls ๐ŸŽ—๏ธ 9352988975 Sizzling | Escorts | G...( Pune ) VIP Pimpri Chinchwad Call Girls ๐ŸŽ—๏ธ 9352988975 Sizzling | Escorts | G...
( Pune ) VIP Pimpri Chinchwad Call Girls ๐ŸŽ—๏ธ 9352988975 Sizzling | Escorts | G...
ย 
Shikrapur - Call Girls in Pune Neha 8005736733 | 100% Gennuine High Class Ind...
Shikrapur - Call Girls in Pune Neha 8005736733 | 100% Gennuine High Class Ind...Shikrapur - Call Girls in Pune Neha 8005736733 | 100% Gennuine High Class Ind...
Shikrapur - Call Girls in Pune Neha 8005736733 | 100% Gennuine High Class Ind...
ย 
(INDIRA) Call Girl Pune Call Now 8250077686 Pune Escorts 24x7
(INDIRA) Call Girl Pune Call Now 8250077686 Pune Escorts 24x7(INDIRA) Call Girl Pune Call Now 8250077686 Pune Escorts 24x7
(INDIRA) Call Girl Pune Call Now 8250077686 Pune Escorts 24x7
ย 
Low Sexy Call Girls In Mohali 9053900678 ๐ŸฅตHave Save And Good Place ๐Ÿฅต
Low Sexy Call Girls In Mohali 9053900678 ๐ŸฅตHave Save And Good Place ๐ŸฅตLow Sexy Call Girls In Mohali 9053900678 ๐ŸฅตHave Save And Good Place ๐Ÿฅต
Low Sexy Call Girls In Mohali 9053900678 ๐ŸฅตHave Save And Good Place ๐Ÿฅต
ย 
WhatsApp ๐Ÿ“ž 8448380779 โœ…Call Girls In Mamura Sector 66 ( Noida)
WhatsApp ๐Ÿ“ž 8448380779 โœ…Call Girls In Mamura Sector 66 ( Noida)WhatsApp ๐Ÿ“ž 8448380779 โœ…Call Girls In Mamura Sector 66 ( Noida)
WhatsApp ๐Ÿ“ž 8448380779 โœ…Call Girls In Mamura Sector 66 ( Noida)
ย 
Dubai=Desi Dubai Call Girls O525547819 Outdoor Call Girls Dubai
Dubai=Desi Dubai Call Girls O525547819 Outdoor Call Girls DubaiDubai=Desi Dubai Call Girls O525547819 Outdoor Call Girls Dubai
Dubai=Desi Dubai Call Girls O525547819 Outdoor Call Girls Dubai
ย 
20240508 QFM014 Elixir Reading List April 2024.pdf
20240508 QFM014 Elixir Reading List April 2024.pdf20240508 QFM014 Elixir Reading List April 2024.pdf
20240508 QFM014 Elixir Reading List April 2024.pdf
ย 
Katraj ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready For S...
Katraj ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready For S...Katraj ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready For S...
Katraj ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready For S...
ย 
Hireโ† Young Call Girls in Tilak nagar (Delhi) โ˜Ž๏ธ 9205541914 โ˜Ž๏ธ Independent Esc...
Hireโ† Young Call Girls in Tilak nagar (Delhi) โ˜Ž๏ธ 9205541914 โ˜Ž๏ธ Independent Esc...Hireโ† Young Call Girls in Tilak nagar (Delhi) โ˜Ž๏ธ 9205541914 โ˜Ž๏ธ Independent Esc...
Hireโ† Young Call Girls in Tilak nagar (Delhi) โ˜Ž๏ธ 9205541914 โ˜Ž๏ธ Independent Esc...
ย 
APNIC Updates presented by Paul Wilson at ARIN 53
APNIC Updates presented by Paul Wilson at ARIN 53APNIC Updates presented by Paul Wilson at ARIN 53
APNIC Updates presented by Paul Wilson at ARIN 53
ย 
Al Barsha Night Partner +0567686026 Call Girls Dubai
Al Barsha Night Partner +0567686026 Call Girls  DubaiAl Barsha Night Partner +0567686026 Call Girls  Dubai
Al Barsha Night Partner +0567686026 Call Girls Dubai
ย 
(+971568250507 ))# Young Call Girls in Ajman By Pakistani Call Girls in ...
(+971568250507  ))#  Young Call Girls  in Ajman  By Pakistani Call Girls  in ...(+971568250507  ))#  Young Call Girls  in Ajman  By Pakistani Call Girls  in ...
(+971568250507 ))# Young Call Girls in Ajman By Pakistani Call Girls in ...
ย 
๐Ÿ’š๐Ÿ˜‹ Bilaspur Escort Service Call Girls, 9352852248 โ‚น5000 To 25K With AC๐Ÿ’š๐Ÿ˜‹
๐Ÿ’š๐Ÿ˜‹ Bilaspur Escort Service Call Girls, 9352852248 โ‚น5000 To 25K With AC๐Ÿ’š๐Ÿ˜‹๐Ÿ’š๐Ÿ˜‹ Bilaspur Escort Service Call Girls, 9352852248 โ‚น5000 To 25K With AC๐Ÿ’š๐Ÿ˜‹
๐Ÿ’š๐Ÿ˜‹ Bilaspur Escort Service Call Girls, 9352852248 โ‚น5000 To 25K With AC๐Ÿ’š๐Ÿ˜‹
ย 

Frontend Performance: Illusions & browser rendering

  • 1. Frontend Performance: Illusions & browser rendering Manuel Garcia d.org/user/213194
  • 2. The current situation 80-90% of the end-user response time is spent on the frontend http://www.stevesouders.com/blog/2012/02/10/the-performance-golden-rule/
  • 3. The current situation 80-90% of the end-user response time is spent on the frontend But frontenders are not to blame for ALL of it.
  • 6. How it works source: @jerontjepkema http://www.slideshare.net/MeasureWorks/measureworks-why-people-hate-to-wait-for-your-website-to-load-and-how-to-fix-that they
  • 7. So... Not every second wasted waiting on the browser is the frontenders fault. Latency is a big bottleneck, especially on mobile.
  • 8. What I wonโ€™t be covering: Anything that happens on the server (gzip, varnish, memcache etc). Anything that happens from the server to the browser. What I will cover: Anything that happens after the browser gets the first packet.
  • 9. Outline Brief explanation of how browsers make sense of and render our mess. The path to the first paint - why it is important and how to get there faster. Rendering performance - how not to shoot yourself in the foot. Drupal - the current situation
  • 11. What the browser does Starts receiving data. First packet is about 14K. Parses the HTML and constructs the DOM. Starts downloading assets (images, css, js) - in the order as they come in the HTML source code. Parses CSS and constructs the CSSOM. Constructs the Render Tree (DOM + CSSOM) Calculates Layout (size & position) Paints & composites the layers.
  • 12. What the browser does HTML - Source optimization
  • 13. What the browser does HTML - Source optimization Prioritize content delivery - source order. (Serve first what matters to the user)
  • 14. What the browser does HTML - Source optimization Prioritize content delivery - source order. (Serve first what matters to the user) Limit and minimize assets to download (HTTP requests)
  • 15. What the browser does HTML - Source optimization Prioritize content delivery - source order. (Serve first what matters to the user) Limit and minimize assets to download (HTTP requests) Keep the number of DOM elements under control. (Divitis) -
  • 16. What the browser does Optimizing CSSOM construction
  • 17. What the browser does Optimizing CSSOM construction External stylesheets block rendering.
  • 18. What the browser does Optimizing CSSOM construction External stylesheets block rendering. Serve CSS as early as possible (in <head>)
  • 19. What the browser does Optimizing CSSOM construction External stylesheets block rendering. Serve CSS as early as possible (in <head>) Avoid the use of inefficient CSS selectors (body *, #footer h3)
  • 20. What the browser does Optimizing CSSOM construction External stylesheets block rendering. Serve CSS as early as possible (in <head>) Avoid the use of inefficient CSS selectors (body *, #footer h3) Remove unused CSS rules. Cleanup! -
  • 21. What the browser does Optimizing CSSOM construction - CSS selectors Browser engines evaluate each rule from right to left, starting from the rightmost selector (called the "key") and moving through each selector until it finds a match or discards the rule. https://developer.mozilla.org/en-US/docs/Web/Guide/CSS/Writing_efficient_CSS
  • 22. What the browser does Optimizing CSSOM construction - CSS selectors Avoid a universal key selector: * Allow elements to inherit from ancestors, or use a class to apply a style to multiple elements.
  • 23. What the browser does Optimizing CSSOM construction - CSS selectors Avoid a universal key selector: * Allow elements to inherit from ancestors, or use a class to apply a style to multiple elements. Make your rules as specific as possible. Prefer class and ID selectors over tag selectors.
  • 24. What the browser does Optimizing CSSOM construction - CSS selectors Avoid a universal key selector: * Allow elements to inherit from ancestors, or use a class to apply a style to multiple elements. Make your rules as specific as possible. Prefer class and ID selectors over tag selectors. Remove redundant qualifiers. ID selectors qualified by class and/or tag selectors Class selectors qualified by tag selectors
  • 25. What the browser does Optimizing CSSOM construction - CSS selectors Avoid a universal key selector: * Allow elements to inherit from ancestors, or use a class to apply a style to multiple elements. Make your rules as specific as possible. Prefer class and ID selectors over tag selectors. Remove redundant qualifiers. ID selectors qualified by class and/or tag selectors Class selectors qualified by tag selectors 4. Use class selectors instead of descendant selectors.
  • 26. What the browser does And what about Javascript?
  • 27. What the browser does And what about Javascript? Because it can change the DOM and the CSSDOM, when the browser sees a <script> tag it will block downloading of other assets until the js file has been downloaded and executed.
  • 28. What the browser does source: (Building Faster Websites: Crash Course on Web Performance, Fluent 2013)
  • 29. What the browser does Javascript: Avoid it if not necessary.
  • 30. What the browser does Javascript: Avoid it if not necessary. Inline it in <head> if necessary for above the fold, if it is small, and you are NOT changing the DOM or CSSOM.
  • 31. What the browser does Javascript: Avoid it if not necessary. Inline it in <head> if necessary for above the fold, if it is small, and you are NOT changing the DOM or CSSOM. Normally just place it at the bottom of the page.
  • 32. What the browser does Javascript: Avoid it if not necessary. Inline it in <head> if necessary for above the fold, if it is small, and you are NOT changing the DOM or CSSOM. Normally just place it at the bottom of the page. And/or defer it: <script async src="progressively-enhancing.js"> -
  • 33. The path to first paint
  • 34. t The path to first paint Make it here fast Make it count!
  • 35. The path to first paint Itโ€™s what your users first see. Itโ€™s what the user is stuck with on mobile while waiting to load your 10^6 assets. First paint should be a styled version without JS of your website. It should be functional, which is especially important on slow/unstable connections and old devices. Impacts UX! The fastest first paint would be a flash of unstyled content, if CSS is placed at the end of the page. If the browser has the page title, and shows white screen for seconds long, you have work to do.
  • 36. The path to first paint source: @jerontjepkema http://www.slideshare.net/MeasureWorks/measureworks-why-people-hate-to-wait-for-...
  • 37. The path to first paint How to avoid delaying the first paint 1. Do NOT put external JS in the header.
  • 38. The path to first paint How to avoid delaying the first paint 1. Do NOT put external JS in the header. 2. Prioritize delivery of critical content & assets.
  • 39. The path to first paint How to avoid delaying the first paint 1. Do NOT put external JS in the header. 2. Prioritize delivery of critical content & assets. 3. Minimize the number of assets to download (reduces latency impact).
  • 40. The path to first paint How to avoid delaying the first paint 1. Do NOT put external JS in the header. 2. Prioritize delivery of critical content & assets. 3. Minimize the number of assets to download (reduces latency impact). 4. Minimize the size of assets to download.
  • 41. The path to first paint How to avoid delaying the first paint 1. Do NOT put external JS in the header. 2. Prioritize delivery of critical content & assets. 3. Minimize the number of assets to download (reduces latency impact). 4. Minimize the size of assets to download. 5. Optimize DOM generation.
  • 42. The path to first paint How to avoid delaying the first paint 1. Do NOT put external JS in the header 2. Prioritize delivery of critical content & assets 3. Minimize the number of assets to download (reduces latency impact). 4. Minimize the size of assets to download. 5. Optimize DOM generation. 6. Optimize CSSOM generation.
  • 43. The path to first paint How to avoid delaying the first paint 1. Do NOT put external JS in the header 2. Prioritize delivery of critical content & assets 3. Minimize the number of assets to download (reduces latency impact). 4. Minimize the size of assets to download. 5. Optimize DOM generation. 6. Optimize CSSOM generation. 7. Put Ads and other 3rd party nastiness as low in the source code as possible.
  • 44. The path to first paint Already useful / useable View full test: http://www.webpagetest.org/video/compare.php?tests=140515_0K_NNE-r%3A1-c% 3A0&thumbSize=150&ival=100&end=full Website tested: www.deotramanera.co (Drupal 7)
  • 45. The path to first paint BONUS: rendering performance++ View full test: http://www.webpagetest.org/video/compare.php?tests=140515_0K_NNE-r%3A1-c% 3A0&thumbSize=150&ival=100&end=full Website tested: www.deotramanera.co (Drupal 7)
  • 46. The path to first paint Some general recommendations โ— First rendered frame should contain element positioning and dimensions. โ— Style with disabled JS, as if it was ready to be used (Bonus: Your site will not crumble when your JS breaks.) Use NoScript or similar. โ— The browser uses your CSS, not your SASS file. Try not to nest too much.
  • 47. The path to first paint Some general recommendations โ— First rendered frame should contain element positioning and dimensions. โ— Style with disabled JS, as if it was ready to be used (Bonus: Your site will not crumble when your JS breaks.) Use NoScript or similar. โ— The browser uses your CSS, not your SASS file. Try not to nest too much. Dangers to our render times outside our control: โ— Ads - Get them out of the first paint path. They should not hurt UX. โ— Bad content writing habits (too many iframes, embedded crap) - educate your content creators and/or remove the tags through input filters.
  • 49. Rendering performance The ability for the browser to render composited images fast enough so that it can actually give you at least 25 fps while using the site. You put effort into first paint, do not throw it all away after the fact. Keep your site snappy to use!
  • 50. Rendering performance The ability for the browser to render composited images fast enough so that it can actually give you at least 25 fps while using the site. You put effort into first paint, do not throw it all away after the fact. Keep your site snappy to use! What hurts the render pipeline? โ— Things that invalidate the DOM
  • 51. Rendering performance The ability for the browser to render composited images fast enough so that it can actually give you at least 25 fps while using the site. You put effort into first paint, do not throw it all away after the fact. Keep your site snappy to use! What hurts the render pipeline? โ— Things that invalidate the DOM โ— Things that invalidate the CSSOM
  • 52. Rendering performance The ability for the browser to render composited images fast enough so that it can actually give you at least 25 fps while using the site. You put effort into first paint, do not throw it all away after the fact. Keep your site snappy to use! What hurts the render pipeline? โ— Things that invalidate the DOM โ— Things that invalidate the CSSOM โ— JS animations (use requestAnimationFrame, not jQuery.animate) โ— Flash โ— Ads โ— ...
  • 53. Rendering performance Things that hurt the render pipeline (in-app): โ— Adding/removing/changing HTML elements. โ— Adding/removing CSS classes, adding inline styles. โ— Showing / hiding elements. These cause the browser to invalidate the render tree / layout. It means doing a bunch of expensive things, and if the recalculation gets big and/or gets very frequent, you could lose frames, which results in shuttering etc. If possible, provide the markup for your JS goodies in the original source code. If you get the first paint right, you have most of the job done, donโ€™t mess things up!
  • 55. Drupal Getting Drupal (7) to render fast Minifying and aggregation of CSS and JS: โ— Advanced CSS/JS Aggregation (more features) โ— Speedy (minified versions of core JavaScript) โ— Simple aggregation (reduces the number of aggregated files)
  • 56. Drupal Getting Drupal (7) to render fast Minifying and aggregation of CSS and JS: โ— Advanced CSS/JS Aggregation (more features) โ— Speedy (minified versions of core JavaScript) โ— Simple aggregation (reduces the number of aggregated files) Reduce the number of DOM elements: โ— Fences (leaner markup for fields) โ— Entity view modes โ— Display Suite โ— Optimize your page.tpl, panels tpls, etc Use the minimum number of elements necessary
  • 57. Drupal Getting Drupal (7) to render fast Reduce the amount of CSS /** * Implement hook_css_alter(). */ function MYTHEME_css_alter(&$css) { // Remove a single css file. unset($css[drupal_get_path('module', 'system') . '/defaults.css']); }
  • 58. Drupal Getting Drupal (7) to render fast Reduce the amount of CSS /** * Implement hook_css_alter(). */ function MYTHEME_css_alter(&$css) { // remove all core css files foreach ($css as $key => $file) { if (preg_match('/^modules/', $key)) { unset($css[$key]); } } }
  • 59. Drupal Getting Drupal (7) to render fast Reduce the amount of CSS /** * Implement hook_css_alter(). */ function MYTHEME_css_alter(&$css) { // Remove all but my theme's css files $theme_path = drupal_get_path('theme', 'MYTHEME'); $string_match = '/^'. str_replace('/', '/', $theme_path) .'/'; foreach ($css as $key => $file) { if (!preg_match($string_match, $key)) { unset($css[$key]); } } }
  • 60. Drupal Getting Drupal (7) to render fast async Javascript (D7, done in D8!): Needs backport: #1140356 OR #1664602
  • 61. Drupal Getting Drupal (7) to render fast async Javascript (D7, done in D8!): Needs backport: #1140356 OR #1664602 โ— advagg 7.x-2.6 does it without need to patch core โ— aloha does it in template.php (a bit nasty)
  • 62. Drupal Getting Drupal (7) to render fast async Javascript (D7, done in D8!): aloha does it in hook_process_html(): function aloha_process_html(&$variables) { if (strpos($variables['scripts'], '/lib/aloha.js') !== FALSE) { $variables['scripts'] = preg_replace('/(/lib/aloha.js[^"]*["]) /', '$1 data-aloha-defer-init="true"', $variables['scripts'], 1); } }
  • 63. Drupal Getting Drupal (7) to render fast Moving all JS to the footer: /** * Implements hook_js_alter(). */ function MYTHEME_js_alter(&&javascript) { // Move all JS to the footer. foreach ($javascript as $name => $script) { $javascript[$name]['scope'] = 'footer'; } // Forces Modernizr to header if the module is enabled. if (module_exists('modernizer')) { $javascript[modernizer_get_path()]['scope'] = 'header'; } }
  • 64. Drupal Getting Drupal (7) to render fast Getting rid of ALL Javascript: /** * Implements hook_js_alter(). */ function MYTHEME_js_alter(&$javascript) { // Remove all JS $javascript = array(); // 0_o }
  • 65. Drupal And what about Drupal 8? (pull from 16-mar-2014) Out of the box, front page:
  • 66. Drupal And what about Drupal 8? (pull from 16-mar-2014) Out of the box, front page: โ— CSS & JS aggregation on by default - WIN!
  • 67. Drupal And what about Drupal 8? (pull from 16-mar-2014) Out of the box, front page: โ— CSS & JS aggregation on by default - WIN! โ— 4 CSS files for anonymous, 7 for admin. CSS in <head>.
  • 68. Drupal And what about Drupal 8? (pull from 16-mar-2014) Out of the box, front page: โ— CSS & JS aggregation on by default - WIN! โ— 4 CSS files for anonymous, 7 for admin. CSS in <head>. โ— JS is in <head> & not async by default :(
  • 69. Drupal And what about Drupal 8? (pull from 16-mar-2014) Out of the box, front page: โ— CSS & JS aggregation on by default - WIN! โ— 4 CSS files for anonymous, 7 for admin. CSS in <head>. โ— JS is in <head> & not async by default :( โ— First paint at ~400ms for admin, ~200ms for anonymous.
  • 70. Drupal And what about Drupal 8? (pull from 16-mar-2014) Out of the box, front page: โ— CSS & JS aggregation on by default - WIN! โ— 4 CSS files for anonymous, 7 for admin. CSS in <head>. โ— JS is in <head> & not async by default :( โ— First paint at ~400ms for admin, ~200ms for anonymous. โ—‹ With JS at the bottom, first paint as admin goes down to ~200ms!
  • 71. Drupal And what about Drupal 8? (pull from 16-mar-2014) Out of the box, front page: โ— CSS & JS aggregation on by default - WIN! โ— 4 CSS files for anonymous, 7 for admin. CSS in <head>. โ— JS is in <head> & not async by default :( โ— First paint at ~400ms for admin, ~200ms for anonymous. โ—‹ With JS at the bottom, first paint as admin goes down to ~200ms! โ— In-app paint time is 2-5ms for anonymous, 4-6ms for admin - pretty good, but its an empty page ;)
  • 72. Drupal And what about Drupal 8? It is a lot better than 7.x We only provide the JS needed for each page - WIN! Workโ€™s still being done - tag: frontend performance Get involved: โ— [Meta] selectors clean-up #1574470 โ— jQuery and Drupal JavaScript libraries and settings are output even when no JS is added to the page #1279226 โ— [META] Improving CSS and JS preprocessing #1490312
  • 73. Tools & Resources Tools โ— Webpagetest: http://www.webpagetest.org/ โ— Firefox & Chrome dev tools โ— Google PageSpeed insights: http://developers.google. com/speed/pagespeed/insights/ Further reading, sources and resources โ— Performance profiling with the Timeline: https://developer.chrome.com/devtools/docs/timeline โ— https://developers.google.com/speed/ โ— http://www.stevesouders.com/blog/ โ— https://www.igvita.com/ โ— On Layout & Web Performance http://www.kellegous.com/j/2013/01/26/layout-performance/ โ— Writing efficient CSS https://developer.mozilla.org/en-US/docs/Web/Guide/CSS/Writing_efficient_CSS โ— Best Practices for Speeding Up Your Web Site https://developer.yahoo.com/performance/rules.html โ— Profiling CSS for fun and profit http://perfectionkills.com/profiling-css-for-fun-and-profit-optimization-notes/