Slide 1

Slide 1 text

UnPerformantPress The Problem With WordPress ! peterwilson.cc • @pwcc

Slide 2

Slide 2 text

Timed using WebPageTest - pwcc.cc/wcbne/400ms

Slide 3

Slide 3 text

0.4 peterwilson.cc Timed using WebPageTest - pwcc.cc/wcbne/400ms

Slide 4

Slide 4 text

Timed using WebPageTest - pwcc.cc/wcbne/400ms

Slide 5

Slide 5 text

Timed using WebPageTest - pwcc.cc/wcbne/400ms

Slide 6

Slide 6 text

1.8 peterwilson.cc Timed using WebPageTest - pwcc.cc/wcbne/400ms

Slide 7

Slide 7 text

How To Get A Page Speed Score In The 90s Peter Wilson ! peterwilson.cc • @pwcc

Slide 8

Slide 8 text

pwcc.cc/wcbne/pagespeed

Slide 9

Slide 9 text

pwcc.cc/wcbne/pagespeed

Slide 10

Slide 10 text

Why PageSpeed?

Slide 11

Slide 11 text

Fortherock (CC) - flic.kr/p/6Wyb2u

Slide 12

Slide 12 text

Fortherock (CC) - flic.kr/p/6Wyb2u • SSL • Fast loading

Slide 13

Slide 13 text

F Delventhal (CC) - flic.kr/p/gnLLPF It’s the vibe of the thing

Slide 14

Slide 14 text

Ultimately, your visitors HATE WAITING WITH A PASSION

Slide 15

Slide 15 text

Today’s focus: Code you can upload

Slide 16

Slide 16 text

Visual progress Via WebPageTest

Slide 17

Slide 17 text

Try, Measure, Test

Slide 18

Slide 18 text

WebPageTest - webpagetest.org

Slide 19

Slide 19 text

WebPageTest - webpagetest.org

Slide 20

Slide 20 text

Comparison timelines No SSL vs SSL Timed using WebPageTest - pwcc.cc/wcbne/thesslquestion 0.9s 1.0s 1.1s 1.2s 99% 99% 99% 99% 0% 0% 0% 99% No SSL SSL

Slide 21

Slide 21 text

Comparison timelines No SSL vs SSL Timed using WebPageTest - pwcc.cc/wcbne/thesslquestion 0.9s 1.0s 1.1s 1.2s 99% 99% 99% 99% 0% 0% 0% 99% No SSL SSL

Slide 22

Slide 22 text

Comparison timelines No SSL vs SSL Timed using WebPageTest - pwcc.cc/wcbne/thesslquestion 0.9s 1.0s 1.1s 1.2s 99% 99% 99% 99% 0% 0% 0% 99% No SSL SSL

Slide 23

Slide 23 text

Comparison timelines No SSL vs SSL Timed using WebPageTest - pwcc.cc/wcbne/thesslquestion 0.9s 1.0s 1.1s 1.2s 99% 99% 99% 99% 0% 0% 0% 99% No SSL SSL

Slide 24

Slide 24 text

Key metrics Document Complete Fully Loaded Load Time First Byte Start Render Visually Complete Speed Index DOM Elements Time Requests Bytes In Time Requests Bytes In 3.466s 0.835s 1.190s 3.300s 1221 356 3.466s 18 310 KB 3.614s 20 312 KB WebPageTest - webpagetest.org

Slide 25

Slide 25 text

SSL Waterfall WebPageTest - webpagetest.org

Slide 26

Slide 26 text

SSL Waterfall WebPageTest - webpagetest.org

Slide 27

Slide 27 text

WebPageTest - webpagetest.org SSL Waterfall

Slide 28

Slide 28 text

Measuring is useless

Slide 29

Slide 29 text

Alisha Vargas (CC) - flic.kr/p/6onXW9

Slide 30

Slide 30 text

Performance starts with design

Slide 31

Slide 31 text

No content

Slide 32

Slide 32 text

Let’s write some code

Slide 33

Slide 33 text

We’ve made a plan. Let’s carry it out.

Slide 34

Slide 34 text

JavaScript in the footer

Slide 35

Slide 35 text

All visitors have JavaScript disabled while it downloads. – Every progressive enhancement advocate ever

Slide 36

Slide 36 text

wp_enqueue_script(. ..'pwcc0scripts',..//.handle. ..'/path/file.js',.//.source. ..null,............//.no.dependancies. ..'20150530031',...//.version. ..true.............//.load.in.footer. ); JavaScript, the WordPress way

Slide 37

Slide 37 text

wp_enqueue_script(. ..'pwcc0scripts',..//.handle. ..'/path/file.js',.//.source. ..null,............//.no.dependancies. ..'20150530031',...//.version. ..true.............//.load.in.footer. ); ! ! ! ! ! !!true!!!!!!!!!!!!!//!load!in!footer! JavaScript, the WordPress way

Slide 38

Slide 38 text

wp_enqueue_script(. ..'pwcc0scripts',..//.handle. ..'/path/file.js',.//.source. ..array('jquery'),.//.yay,.jQuery. ..'20150530031',...//.version. ..true.............//.load.in.footer. ); jQuery, the WordPress way

Slide 39

Slide 39 text

wp_enqueue_script(. ..'pwcc0scripts',..//.handle. ..'/path/file.js',.//.source. ..array('jquery'),.//.yay,.jQuery. ..'20150530031',...//.version. ..true.............//.load.in.footer. ); jQuery, the WordPress way ! ! ! !!array('jquery'),!//!yay,!jQuery!magically!loads! ! !

Slide 40

Slide 40 text

. . !!! !!! ... ... jQuery, doing_it_wrong()

Slide 41

Slide 41 text

The WordPress way blocks rendering loading.io

Slide 42

Slide 42 text

Blake Patterson (CC) - flic.kr/p/5EqV3b

Slide 43

Slide 43 text

add_data(.'jquery0core',.'group',.1.);. ! doing_it_wrong_and_loving_it() add_data(.'jquery@core',.'group',.1.);. !

Slide 44

Slide 44 text

wp_enqueue_script(. ..'pwcc0scripts',..//.handle. ..'/path/file.js',.//.source. !!array('jquery@core'),!//!only!jQuery,!no!jQuery@migrate! ..'20150530031',...//.version. ..true.............//.load.in.footer. ); doing_it_wrong_and_loving_it()

Slide 45

Slide 45 text

. . !!! !!! ... ... doing_it_wrong_and_loving_it()

Slide 46

Slide 46 text

. . ! ... !!! ... doing_it_wrong_and_loving_it()

Slide 47

Slide 47 text

. . ! ... !!! ... doing_it_wrong_and_loving_it() pwcc.cc/wcbne/jqueryfooter

Slide 48

Slide 48 text

Load all the things asynchronously

Slide 49

Slide 49 text

Asynchronous JavaScript ..... ... ... ..

Slide 50

Slide 50 text

function.pwcc_async_js(.$tag,.$handle.).{. ..switch.(.$handle.).{. ...case.'pwcc0scripts'.:. ....$tag.=.str_replace('>

Slide 51

Slide 51 text

..switch.(.$handle.).{. ...case.'pwcc0scripts'.:.//.falls.through. ...case.'picturefill'..:. ...$tag.=.str_replace('>

Slide 52

Slide 52 text

..switch.(.$handle.).{. ...case.'pwcc0scripts'.:.//.falls.through. ...case.'picturefill'..:.//.falls.through. ...case.'devicepx'.....:. ...$tag.=.str_replace('>

Slide 53

Slide 53 text

function.pwcc_async_js(.$tag,.$handle.).{. ..switch.(.$handle.).{. ....…. ..}. ..return.$tag;. }. ! add_filter(/'script_loader_tag',/'pwcc_async_js',/10,/2/); Asynchronous JavaScript

Slide 54

Slide 54 text

function.pwcc_async_to_header().{. ..global.$wp_scripts;. ..$wp_scripts0>add_data(.'picturefill',..'group',.0.);. ..$wp_scripts0>add_data(.'pwcc0scripts',.'group',.0.);. ..$wp_scripts0>add_data(.'devicepx',.....'group',.0.);. }. add_action('wp_enqueue_scripts','pwcc_async_to_header',99); Asynchronous JS in the header

Slide 55

Slide 55 text

function.pwcc_async_to_header().{. ..global.$wp_scripts;. ..$wp_scripts0>add_data(.'picturefill',..'group',.0.);. ..$wp_scripts0>add_data(.'pwcc0scripts',.'group',.0.);. ..$wp_scripts0>add_data(.'devicepx',.....'group',.0.);. }. add_action('wp_enqueue_scripts','pwcc_async_to_header',99); Asynchronous JS in the header pwcc.cc/wcbne/asyncjs

Slide 56

Slide 56 text

Asynchronous CSS

Slide 57

Slide 57 text

Yutaka Tsutano (CC) - flic.kr/p/8d4XxS • VIA Gallery (CC) - flic.kr/p/5QTEFc

Slide 58

Slide 58 text

No content

Slide 59

Slide 59 text

No content

Slide 60

Slide 60 text

No content

Slide 61

Slide 61 text

No content

Slide 62

Slide 62 text

No content

Slide 63

Slide 63 text

No content

Slide 64

Slide 64 text

No content

Slide 65

Slide 65 text

No content

Slide 66

Slide 66 text

. . @0ms0viewport{width:device0width;zoom:1}@0o0viewport. {width:device0width;zoom:1}@viewport{width:device0width;. zoom:1}html{font0family:sans0serif;0ms0text0size0adjust: 100%;0webkit0text0size0adjust:100%}body{margin:0}article,. aside,details,figcaption,figure,footer,header,hgroup,main,. nav,section,summary{display:block}audio,canvas,progress,. video{display:inline0block;vertical0align:baseline} audio:not([controls]){display:none;height:0}[hidden],. template{display:none}a{background:transparent}a:active,.

Slide 67

Slide 67 text

No content

Slide 68

Slide 68 text

pwcc.cc/wcbne/loadcss

Slide 69

Slide 69 text

wp_register_style(. ..'pwcc0styles',........//.handle. ..'/style.min.css',.....//.file. ..null,.................//.dependencies. .."20150530031".........//.version. );. CSS, the WordPress way functions.php

Slide 70

Slide 70 text

if.(.is_css_file_cached().).{. .wp_enqueue_style(.'pwcc0styles'.);. }. ! ! ! CSS, the WordPress way functions.php/(pseudo/code)

Slide 71

Slide 71 text

if.(.is_css_file_cached().).{. .wp_enqueue_style(.'pwcc0styles'.);. }. ! ! ! else.{. .//.prepare.for.script.to.be.inlined.(file.is.not.cached). .$inlineCss[].=."pwcc0styles";. } CSS, the WordPress way functions.php/(pseudo/code)

Slide 72

Slide 72 text

if.(.!.is_css_file_cached().).{. ..echo.'';. ..echo.$inlineCss;. ..echo.'';. ! ! } CSS, the WordPress way header.php/(pseudo/code)

Slide 73

Slide 73 text

Photos by Michaela (CC) - flic.kr/p/p9pbn8

Slide 74

Slide 74 text

Curimedia (CC) - flic.kr/p/r6xPDP

Slide 75

Slide 75 text

if.(.!is_css_file_cached().).{. ..echo.''...$inlineCss...'';. ..echo.'';. ..echo.'loadCss(."style.min.css".);';. ! ..echo.'';. } CSS, the WordPress way header.php/(pseudo/code)

Slide 76

Slide 76 text

if.(.!is_css_file_cached().).{. ..echo.''...$inlineCss...'';. ..echo.'';. ..echo.'loadCss(."style.min.css".);';. ! ..echo.'';. } CSS, the WordPress way header.php/(pseudo/code) if.(.!is_css_file_cached().).{. ..echo.''...$inlineCss...'';. ..echo.'';. ..echo.'loadCss(."style.min.css".);';. ..set_css_cached(.'pwcc0styles'.);. ..echo.'';. }

Slide 77

Slide 77 text

set_css_cached functions.js ! ! document.cookie.=.'csscached=20150530031;.path=/';. ! ! !

Slide 78

Slide 78 text

is_css_file_cached functions.php if.(.isset(.$_COOKIE["csscached"].).&&.. ...(."20150530031".==.$_COOKIE["csscached"].).).{. .return.true;. }. else.{. .return.false;. }

Slide 79

Slide 79 text

. . @0ms0viewport{width:device0width;zoom:1}@0o0viewport. {width:device0width;zoom:1}@viewport{width:device0width;. zoom:1}html{font0family:sans0serif;0ms0text0size0adjust: 100%;0webkit0text0size0adjust:100%}body{margin:0}article,. aside,details,figcaption,figure,footer,header,hgroup,main,. nav,section,summary{display:block}audio,canvas,progress,. video{display:inline0block;vertical0align:baseline} audio:not([controls]){display:none;height:0}[hidden],. template{display:none}a{background:transparent}a:active,.

Slide 80

Slide 80 text

. . . ! . . . .

Slide 81

Slide 81 text

. . . ! . . . . pwcc.cc/wcbne/inlinecss

Slide 82

Slide 82 text

Flash of unstyled text meet your new best friend

Slide 83

Slide 83 text

No content

Slide 84

Slide 84 text

Visual progress Via WebPageTest

Slide 85

Slide 85 text

Visual progress Via WebPageTest

Slide 86

Slide 86 text

Invisisble

Slide 87

Slide 87 text

No content

Slide 88

Slide 88 text

No content

Slide 89

Slide 89 text

No content

Slide 90

Slide 90 text

Unstyled

Slide 91

Slide 91 text

No content

Slide 92

Slide 92 text

No content

Slide 93

Slide 93 text

No content

Slide 94

Slide 94 text

We could also use browser fonts. Just occasionally.

Slide 95

Slide 95 text

We could also use browser fonts. Just occasionally. We could also use browser fonts. Just occasionally.

Slide 96

Slide 96 text

Validate me on Social Media

Slide 97

Slide 97 text

No content

Slide 98

Slide 98 text

No content

Slide 99

Slide 99 text

No content

Slide 100

Slide 100 text

The Facebook like button: 56 bytes per pixel

Slide 101

Slide 101 text

“That’s fooked, how the fook can it take fifty-two-point-fooking-eight- fooking-kilobytes to display a fooking like button. A fooking like button no one will ever fooking press anyway!”

Slide 102

Slide 102 text

Like us on Facebook ! . ...... .....Like.us.on.Facebook. .

Slide 103

Slide 103 text

Like us with CSS

Slide 104

Slide 104 text

Like us with CSS pwcc.cc/wcbne/fbcss

Slide 105

Slide 105 text

A mark a yen a buck or a pound money makes the world go round

Slide 106

Slide 106 text

alistapart.com

Slide 107

Slide 107 text

zeldman.com

Slide 108

Slide 108 text

daringfireball.net

Slide 109

Slide 109 text

dribbble.com

Slide 110

Slide 110 text

Download 15 free, beautiful, high res photos for your next project. ! ! Ads by the Network Ian Sane (CC) - flic.kr/p/dqLXek

Slide 111

Slide 111 text

Bad advertising insert code ! (function(id).{. .document.write(''.+.'script>');. })(“AL");.

Slide 112

Slide 112 text

Bad advertising insert code ! (function(id).{. .document.write(''.+.'script>');. })(“AL");. ! ! .document.write. ! ! !

Slide 113

Slide 113 text

Bad advertising insert code ! (function(id).{. .document.write(''.+.'script>');. })(“AL");. ! ! .................

Slide 114

Slide 114 text

No content

Slide 115

Slide 115 text

No content

Slide 116

Slide 116 text

Slightly better ad code ! ... ... ! ...

Slide 117

Slide 117 text

Slightly better ad code ! ... ... ..... ...

Slide 118

Slide 118 text

All this and more.

Slide 119

Slide 119 text

Performance tuning my site increased my traffic

Slide 120

Slide 120 text

Performance tuning my site got me more Googles

Slide 121

Slide 121 text

More to do

Slide 122

Slide 122 text

Ignore best practice

Slide 123

Slide 123 text

Thank you Peter Wilson ! peterwilson.cc • @pwcc