SlideShare a Scribd company logo
ben@cornershopcreative.com
front-end
performance
optimization
#WCDAYTON
SPEED MATTERS
SEO - UX - Sales - Mobile
OUR ENEMIES
Payload size

Bloated DOM & CSS

HTTP connections
JavaScript blocking
DNS lookups
NOT COVERED
Apache/mySQL config
!
Using a CDN
!
Choosing a good host
REDUCE PAYLOAD
a.k.a. front-end performance 101
REDUCE ASSET SIZES
Minify your JS and CSS (and HTML)
Load properly-sized images
Use right image filetypes 

(gif/jpg/png/svg)
DEFER ASSET LOADING
“lazy load” images when they 

appear in browser window
Use async/defer <script> attributes
!
Also, load pre-cached stuff!
<script defer async src="script.js"></script>
TRICKING
WP_ENQUEUE_SCRIPT
function	
  add_async(	
  $url	
  )	
  {	
  
	
  	
  if	
  (strpos($url,	
  '#async')===false)	
  
	
  	
  	
  	
  return	
  $url;	
  
	
  	
  else	
  if	
  (is_admin())	
  
	
  	
  	
  	
  return	
  str_replace('#async',	
  '',	
  $url);	
  
	
  	
  else	
  
	
  	
  	
  	
  return	
  str_replace('#async',	
  '',	
  $url)."'	
  async";	
  	
  
}	
  
add_filter('clean_url',	
  'add_async',	
  11,	
  1);
wp_enqueue_script('demo',	
  '/js/myscript.js#async'	
  );
USING GOOGLE’S
JQUERY
wp_deregister_script('jquery');	
  
wp_register_script(	
  
	
  	
  'jquery',	
  	
  
	
  	
  'http://ajax.googleapis.com/ajax/libs/jquery/
1.11.0/jquery.min.js',	
  
	
  	
  array(),	
  
	
  	
  '1.11.0'	
  
);	
  
BLOATED DOM & CSS
make it clean before you make it mini
MORE ELEMENTS = SLOWER
<body class="page">	
<div id="wrapper">	
<div id="page">	
<div id="main">	
<div class="main-side">	
<aside id="sidebar">	
...	
</aside>	
</div>	
</div>	
</div>	
</div>	
</body>
You can do a count with:
!
$(‘*’).length;
!
or
!
document.
getElementsByTagName(‘*”).
length
SIMPLE SELECTORS
html body div#main article#post-22 p a.inline {

property: value;

}
.inline {

property: value;

}
VS.
ul li {} is slower than ul > li {} which is slower than .ul-li {}
HTTP CONNECTIONS
your biggest obstacles to fast loads
HTTP CONNECTIONS
Each asset (script, image, css file,
font, etc) is retrieved via an HTTP
connection.
Each connection takes a moment
to start due to overhead.
HTTP HEADERS
REDUCING
CONNECTIONS
Combine CSS Files
Combine JS Files
Use CSS Sprites
Avoid images in favor of CSS
Don’t load stuff you don’t need*
COMBINING CSS FILES
Use a tool like SASS that combines
them for you
Only write a single style.css
Use a plugin (e.g. W3 Total Cache) to
combine (& compress!) them for you.
COMBINING JS FILES
Use a plugin (e.g. W3 Total Cache)
to combine+compress

them for you.
Manually put all your jQuery 

plugins into a single file.
COMBINING JS FILES
WordPress is especially prone to
loading lots of JS files
It’s worth the effort to mitigate
against this. Seriously.
CSS SPRITES
Put all your images into a single 

file, and use CSS to position the
background properly.
CSS SPRITE EXAMPLE
.sprite-ben {
height: 117px;
width: 91px;
background-image: url('img/sprite.png');
background-position: 0 -525px;
background-repeat: no-repeat;
}
overall sprite.png file
measures 304 x 910
but my headshot is a small part
DON’T USE IMAGES
CSS3 provides alternatives:
Gradients
Rounded Corners
Text and box shadows
Rotation
JAVASCRIPT BLOCKING
And sequential loading general
SEQUENTIAL VS. PARALLEL
Browsers can load some
assets in parallel, such as
CSS files, images, and
fonts. This is good.
But some assets —JS files
— are loaded in sequence
and block others.
CSS AND SCRIPTS
JS should be at bottom of page.
CSS should go at the top of your
page and be loaded via
<link> not @import
IN WORDPRESS
wp_enqueue_script( 	
$handle,	
$src,	
$deps,	
$ver,	
$in_footer 	
);
Set to TRUE
DNS LOOKUPS
hidden time thieves
DNS LOOKUPS
Every domain mentioned 

on your page needs to be
resolved to an IP (20-120 ms)
!
But too few domains 

is bad too.
TOOLS
FOR MORE
Google “Steve Souder”
https://developers.google.com/speed/docs/best-
practices/rules_intro
!
http://developer.yahoo.com/yslow/
!
https://developers.google.com/speed/
pagespeed/
CONNECT
Ben Byrne
ben@cornershopcreative.com
facebook.com/drywall
Twitter: @drywall

More Related Content

PPTX
An Overview on Nuxt.js
PDF
High Performance Front-End Development
PPTX
DevNexus 2016
PDF
The way to be a developer "What I Need"
PDF
Олег Слободской "UVP of CSSinJS and the future"
PPTX
How do we work with Angular.js
PPT
JS, CMS, untangle the mess
PPTX
Static website generator
An Overview on Nuxt.js
High Performance Front-End Development
DevNexus 2016
The way to be a developer "What I Need"
Олег Слободской "UVP of CSSinJS and the future"
How do we work with Angular.js
JS, CMS, untangle the mess
Static website generator

What's hot (20)

PPTX
Web performance
PDF
WordPress & Backbone.js
PPT
Os mobile
PPTX
Client responsive design
PDF
Hello, Canvas.
PDF
Hidden Secrets For A Hack-Proof Joomla! Site
PPTX
You know what iMEAN? Using MEAN stack for application dev on Informix
PPT
Os mobile
PPTX
jQuery - Web Engineering
PPTX
Vue js for beginner
PPTX
Introduction to mean stack
PPTX
PDF
Wordpress as a Backend
PPTX
How to dominate a free theme WCTO 2014
PPTX
Html5 & less css
PDF
How to Speed Up Your Joomla! Site
PDF
Going Node.js at Netflix
PDF
UXify 2015 - Front-end Developers' Checklist for Better UX
PDF
Responsive WordPress workflow
PDF
How to Speed Up Your Joomla Website
Web performance
WordPress & Backbone.js
Os mobile
Client responsive design
Hello, Canvas.
Hidden Secrets For A Hack-Proof Joomla! Site
You know what iMEAN? Using MEAN stack for application dev on Informix
Os mobile
jQuery - Web Engineering
Vue js for beginner
Introduction to mean stack
Wordpress as a Backend
How to dominate a free theme WCTO 2014
Html5 & less css
How to Speed Up Your Joomla! Site
Going Node.js at Netflix
UXify 2015 - Front-end Developers' Checklist for Better UX
Responsive WordPress workflow
How to Speed Up Your Joomla Website
Ad

Viewers also liked (10)

PPTX
Front end optimization
PDF
WordPress Front End Optimizations
PPTX
Front end performance optimization
PPTX
Cloud Connect Santa Clara 2013: Web Acceleration and Front-End Optimization (...
PDF
Front-End Optimization (FEO)
PPTX
Marrying CDNs with Front-End Optimization
PPT
Heavy Web Optimization: Frontend
DOC
Online shopping report-6 month project
PPTX
Automated cell counters
PPTX
Image processing ppt
Front end optimization
WordPress Front End Optimizations
Front end performance optimization
Cloud Connect Santa Clara 2013: Web Acceleration and Front-End Optimization (...
Front-End Optimization (FEO)
Marrying CDNs with Front-End Optimization
Heavy Web Optimization: Frontend
Online shopping report-6 month project
Automated cell counters
Image processing ppt
Ad

Similar to Front-End Performance Optimization in WordPress (20)

PDF
PPTX
Optimizing Your WordPress Site: Why speed matters, and how to get there
PDF
Does This Theme Make My Website Look Fat? (Wordcamp SLC 2013)
PDF
The Need for Speed (5 Performance Optimization Tipps) - brightonSEO 2014
PPTX
Minimize website page loading time – 20+ advanced SEO tips
PPTX
Tom Bennet – BrightonSEO April 2016: Site Speed for content Marketers
PDF
Optimizing the performance of WordPress
PPTX
Website Performance
PPT
Frontend performance
PPT
performance.ppt
PPTX
The Need for Speed - SMX Sydney 2013
PDF
WordPress website optimization
PDF
How to optimize and speed-up your website. The complete guide.
PDF
Need for Speed - Gear Up Your WordPress
PDF
How to speed up your website
PPTX
Speed up your site! #wcmtl2015 by Meagan Hanes
PDF
Website speed optimization guide for technically advanced webmasters
PDF
How do you speed up your (Wordpress) website?
PDF
Website optimization
PPTX
Search Oxford March 2022 - Most common ecommerce mistakes that are killing yo...
Optimizing Your WordPress Site: Why speed matters, and how to get there
Does This Theme Make My Website Look Fat? (Wordcamp SLC 2013)
The Need for Speed (5 Performance Optimization Tipps) - brightonSEO 2014
Minimize website page loading time – 20+ advanced SEO tips
Tom Bennet – BrightonSEO April 2016: Site Speed for content Marketers
Optimizing the performance of WordPress
Website Performance
Frontend performance
performance.ppt
The Need for Speed - SMX Sydney 2013
WordPress website optimization
How to optimize and speed-up your website. The complete guide.
Need for Speed - Gear Up Your WordPress
How to speed up your website
Speed up your site! #wcmtl2015 by Meagan Hanes
Website speed optimization guide for technically advanced webmasters
How do you speed up your (Wordpress) website?
Website optimization
Search Oxford March 2022 - Most common ecommerce mistakes that are killing yo...

More from drywallbmb (9)

PDF
Accessibility: Beginning the Journey
PDF
Do more, faster, by extending WP-CLI
PDF
Accessibility: Beginning the Journey
PDF
Accelerating Custom Development with Dynamic Scaffolding and WP-CLI
PDF
Accelerating Custom Development with Dynamic Scaffolding and WP-CLI
PDF
Making Multisite Work for You
PDF
Finding your way with Sass+Compass
PDF
10 Cool Things You Can Do with Widgets
PDF
The Difference Between Print and Web Design
Accessibility: Beginning the Journey
Do more, faster, by extending WP-CLI
Accessibility: Beginning the Journey
Accelerating Custom Development with Dynamic Scaffolding and WP-CLI
Accelerating Custom Development with Dynamic Scaffolding and WP-CLI
Making Multisite Work for You
Finding your way with Sass+Compass
10 Cool Things You Can Do with Widgets
The Difference Between Print and Web Design

Recently uploaded (20)

PDF
Encapsulation theory and applications.pdf
PPTX
1. Introduction to Computer Programming.pptx
PDF
MIND Revenue Release Quarter 2 2025 Press Release
PDF
ENT215_Completing-a-large-scale-migration-and-modernization-with-AWS.pdf
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PDF
Hindi spoken digit analysis for native and non-native speakers
PDF
Web App vs Mobile App What Should You Build First.pdf
PPTX
TechTalks-8-2019-Service-Management-ITIL-Refresh-ITIL-4-Framework-Supports-Ou...
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PDF
Unlocking AI with Model Context Protocol (MCP)
PDF
Accuracy of neural networks in brain wave diagnosis of schizophrenia
PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
PDF
Assigned Numbers - 2025 - Bluetooth® Document
PPTX
Tartificialntelligence_presentation.pptx
PDF
DASA ADMISSION 2024_FirstRound_FirstRank_LastRank.pdf
PDF
NewMind AI Weekly Chronicles - August'25-Week II
PDF
gpt5_lecture_notes_comprehensive_20250812015547.pdf
PPTX
cloud_computing_Infrastucture_as_cloud_p
PPTX
Chapter 5: Probability Theory and Statistics
PDF
Getting Started with Data Integration: FME Form 101
Encapsulation theory and applications.pdf
1. Introduction to Computer Programming.pptx
MIND Revenue Release Quarter 2 2025 Press Release
ENT215_Completing-a-large-scale-migration-and-modernization-with-AWS.pdf
Agricultural_Statistics_at_a_Glance_2022_0.pdf
Hindi spoken digit analysis for native and non-native speakers
Web App vs Mobile App What Should You Build First.pdf
TechTalks-8-2019-Service-Management-ITIL-Refresh-ITIL-4-Framework-Supports-Ou...
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
Unlocking AI with Model Context Protocol (MCP)
Accuracy of neural networks in brain wave diagnosis of schizophrenia
Digital-Transformation-Roadmap-for-Companies.pptx
Assigned Numbers - 2025 - Bluetooth® Document
Tartificialntelligence_presentation.pptx
DASA ADMISSION 2024_FirstRound_FirstRank_LastRank.pdf
NewMind AI Weekly Chronicles - August'25-Week II
gpt5_lecture_notes_comprehensive_20250812015547.pdf
cloud_computing_Infrastucture_as_cloud_p
Chapter 5: Probability Theory and Statistics
Getting Started with Data Integration: FME Form 101

Front-End Performance Optimization in WordPress