Slide 1

Slide 1 text

i! GoMakeThings.com 5 @ChrisFerdinandi #! WICKED FAST WORDPRESS

Slide 2

Slide 2 text

20% decrease in search traffic from just a 500ms delay Source: www.slideshare.net/stubbornella/designing-fast-websites-presentation

Slide 3

Slide 3 text

1% loss in sales from just a 100ms delay Source: www.slideshare.net/stubbornella/designing-fast-websites-presentation

Slide 4

Slide 4 text

$6.1M based on 2012 sales

Slide 5

Slide 5 text

600kb average webpage size in 2010 Source: www.webperformancetoday.com/2013/06/05/web-page-growth-2010-2013/

Slide 6

Slide 6 text

1.2mb average webpage size in 2013 Source: www.webperformancetoday.com/2013/06/05/web-page-growth-2010-2013/

Slide 7

Slide 7 text

2x in just three years Source: www.webperformancetoday.com/2013/06/05/web-page-growth-2010-2013/

Slide 8

Slide 8 text

COMPUTERS GET FASTER EVERY YEAR. Everybody

Slide 9

Slide 9 text

Source: www.lukew.com

Slide 10

Slide 10 text

MOBILE IS THE WEB $!

Slide 11

Slide 11 text

Source: www.google.com/think/research-studies/creating-moments-that-matter.html 77% of mobile searches happen at work or at home ^! =!

Slide 12

Slide 12 text

Source: www.flickr.com/photos/cseeman/4020336221/

Slide 13

Slide 13 text

55% AMERICANS WHO HAVE ACCESSED THE WEB via a mobile device in 2012 Source: blogs.hbr.org/cs/2013/05/the_rise_of_the_mobile-only_us.html

Slide 14

Slide 14 text

31% AMERICANS WHO HAVE PRIMARILY ACCESSED THE WEB via a mobile device in 2012 Source: blogs.hbr.org/cs/2013/05/the_rise_of_the_mobile-only_us.html

Slide 15

Slide 15 text

74% of mobile users will leave your site if it takes more than 5 seconds to load Source: bradfrostweb.com/blog/post/performance-as-design/

Slide 16

Slide 16 text

4G LTE IS AS FAST AS BROADBAND WIFI. Everybody

Slide 17

Slide 17 text

No content

Slide 18

Slide 18 text

Source: www.flickr.com/photos/elviskennedy/8131276426/

Slide 19

Slide 19 text

Source: www.flickr.com/photos/jonathankosread/8026724727/

Slide 20

Slide 20 text

Source: www.flickr.com/photos/ericparker/2102020762/

Slide 21

Slide 21 text

No content

Slide 22

Slide 22 text

No content

Slide 23

Slide 23 text

No content

Slide 24

Slide 24 text

WHAT CAN YOU DO ABOUT IT?

Slide 25

Slide 25 text

) READS HTML * RENDERS CONTENT + DOWNLOADS FILES (2 at a time) CSS stops rendering JS stops downloads

Slide 26

Slide 26 text

No content

Slide 27

Slide 27 text

) READS HTML * RENDERS CONTENT + DOWNLOADS FILES (2 at a time) CSS stops rendering JS stops downloads

Slide 28

Slide 28 text

) READS HTML * RENDERS CONTENT + DOWNLOADS FILES (2 at a time) CSS stops rendering JS stops downloads

Slide 29

Slide 29 text

)! HTML ORDER MATTERS

Slide 30

Slide 30 text

CSS AT THE TOP to avoid repaints JS AT THE BOTTOM* to maximize downloads * Exception: Modernizr (and similar scripts)

Slide 31

Slide 31 text

) READS HTML * RENDERS CONTENT + DOWNLOADS FILES (2 at a time) CSS stops rendering JS stops downloads

Slide 32

Slide 32 text

# FAST 300kb @ SLOW 100kb 100kb 100kb

Slide 33

Slide 33 text

DNS LOOKUPS HTTP HEADERS REDIRECTS 404s Lots of places for things to go wrong ~!

Slide 34

Slide 34 text

COMBINE LIKE FILES -! (concatenation)

Slide 35

Slide 35 text

@ SLOW dropdowns.js fitvids.js modals.js # FAST scripts.js

Slide 36

Slide 36 text

Browsers download all files regardless of screen size @ SLOW header.php

Slide 37

Slide 37 text

# FAST .base-styles { … } @media (min-width: 20em) { … } @media (min-width: 40em) { … } @media (min-width: 60em) { … } header.php style.css

Slide 38

Slide 38 text

file weight

Slide 39

Slide 39 text

REMOVE WHITESPACE s! (minification)

Slide 40

Slide 40 text

No content

Slide 41

Slide 41 text

~40% reduction in file size

Slide 42

Slide 42 text

No content

Slide 43

Slide 43 text

No content

Slide 44

Slide 44 text

No content

Slide 45

Slide 45 text

No content

Slide 46

Slide 46 text

STYLE.CSS (human-readable) STYLE.MIN.CSS (minified)

Slide 47

Slide 47 text

REPLACE THIS "> WITH THIS

Slide 48

Slide 48 text

No content

Slide 49

Slide 49 text

No content

Slide 50

Slide 50 text

SCRIPTS.JS (human-readable) SCRIPTS.MIN.JS (minified)

Slide 51

Slide 51 text

GOOGLE-HOSTED JQUERY //ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js 93kb

Slide 52

Slide 52 text

GOOGLE-HOSTED JQUERY W/ FALLBACK https://gist.github.com/wpsmith/4083811

Slide 53

Slide 53 text

No content

Slide 54

Slide 54 text

MINIFY YOUR HTML https://gist.github.com/cferdinandi/6009555

Slide 55

Slide 55 text

No content

Slide 56

Slide 56 text

No content

Slide 57

Slide 57 text

USE IMAGES WISELY r!

Slide 58

Slide 58 text

ICON FONTS Lightweight A single file Styleable with CSS Scalable Compatible back to IE 5 Considerations 1 color per icon* Windows Phone 7 support sucks

Slide 59

Slide 59 text

@font-face { … } .icon-twitter:before { font-family: icon-font; content: "\e001"; color: #0088cc; font-size: 4em; } 5!

Slide 60

Slide 60 text

Source: icomoon.io

Slide 61

Slide 61 text

Source: icomoon.io

Slide 62

Slide 62 text

HOW TO USE ICON FONTS http://gomakethings.com/icon-fonts/

Slide 63

Slide 63 text

SMARTER IMAGE FORMATS PNGs Logos Clean, simple images JPGs Photos Noisy images

Slide 64

Slide 64 text

COMPRESS JPGs 676kb 92kb

Slide 65

Slide 65 text

87% reduction in file size

Slide 66

Slide 66 text

70 High-quality JPG compression 90 WordPress default

Slide 67

Slide 67 text

add_filter('jpeg_quality', function($arg){return 70;}); Source: www.wpbeginner.com/wp-tutorials/how-to-increase-or-decrease-wordpress-jpeg-image-compression/ produces fuzzy images

Slide 68

Slide 68 text

COMPRESS & SHARPEN IMAGES https://gist.github.com/cferdinandi/6009875

Slide 69

Slide 69 text

Source: imageoptim.com/ SMUSH IMAGES

Slide 70

Slide 70 text

Source: wordpress.org/plugins/wp-smushit/ SMUSH.IT PLUGIN

Slide 71

Slide 71 text

IMAGE SPRITES (background-image instead of @font-face) 5! 0! 2! 3! 4! 1! 5! 0! 2! 3! 4! 1!

Slide 72

Slide 72 text

# FAST 300kb @ SLOW 100kb 100kb 100kb

Slide 73

Slide 73 text

IMAGE SPRITE GENERATOR http://spritegen.website-performance.org/

Slide 74

Slide 74 text

USE ADAPTIVE IMAGES q!

Slide 75

Slide 75 text

http://adaptive-images.com

Slide 76

Slide 76 text

COMPRESS YOUR SITE a! (gzipping)

Slide 77

Slide 77 text

~70% reduction in website size Source: developer.yahoo.com/performance/rules.html

Slide 78

Slide 78 text

APACHE .HTACCESS FILE https://github.com/cferdinandi/htaccess

Slide 79

Slide 79 text

# BEGIN WordPress RewriteEngine On RewriteBase /your-site/ RewriteRule ^index\.php$ - [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /your-site/index.php [L] # END WordPress

Slide 80

Slide 80 text

SET EXPIRE HEADERS c!

Slide 81

Slide 81 text

# Your document html ExpiresByType text/html "access plus 0 seconds" # Media: images, video, audio ExpiresByType image/gif "access plus 1 month" ExpiresByType image/jpeg "access plus 1 month" ExpiresByType image/png "access plus 1 month" ExpiresByType video/mp4 "access plus 1 month" ExpiresByType video/ogg "access plus 1 month"

Slide 82

Slide 82 text

APACHE .HTACCESS FILE https://github.com/cferdinandi/htaccess

Slide 83

Slide 83 text

STYLE.MIN.07232013.JS

Slide 84

Slide 84 text

! & + & + & = ) ) READS HTML * RENDERS CONTENT + DOWNLOADS FILES (2 at a time) CSS stops rendering JS stops downloads

Slide 85

Slide 85 text

No content

Slide 86

Slide 86 text

74% of my users just left

Slide 87

Slide 87 text

PRE-BUILD YOUR SITE t!

Slide 88

Slide 88 text

! & + & + & = ) ) READS HTML * RENDERS CONTENT + DOWNLOADS FILES (2 at a time) CSS stops rendering JS stops downloads

Slide 89

Slide 89 text

PRE-BUILT Much Faster!

Slide 90

Slide 90 text

Source: wordpress.org/plugins/quick-cache/

Slide 91

Slide 91 text

WEBSITE SPEED TEST http://tools.pingdom.com/fpt/

Slide 92

Slide 92 text

1.  HTML order matters 2.  Combine like files 3.  Remove whitespace 4.  Use icon fonts (or sprites) 5.  Pick the right image format 6.  Compress & smush images 7.  Use adaptive images 8.  Compress your site 9.  Set Expires headers 10.  Prebuild your site #! WICKED FAST WORDPRESS

Slide 93

Slide 93 text

GoMakeThings.com @ChrisFerdinandi [email protected] i! CHRIS FERDINANDI Kraken