Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Super Fast WordPress Themes: WordCamp Minneapol...

Super Fast WordPress Themes: WordCamp Minneapolis, 2015

Today’s web users have the need for speed. With internet and cellular connections getting faster and faster, users expect sites to feel snappy and not make them wait. We as developers must make sure we’re doing our very best to serve those pages quickly. This talk will focus on the things you should be doing, both on the front-end and back-end, when building WordPress themes.

Trevan Hetzel

April 26, 2015
Tweet

More Decks by Trevan Hetzel

Other Decks in Design

Transcript

  1. Perceived performance Performance should be thought of in terms of

    both quantitative measured time AND how a page is perceived.
  2. Pagespeed Insights My go-to tool for examining how optimized your

    site is. Lets you know: • if images need optimized • if scripts and stylesheets are loaded properly • and much more
  3. WebPageTest • My go-to tool for testing actual performance •

    Speed index is great for measuring perceived performance • Shoot for a low Speed Index (1000 is a good goal)
  4. “80-90% of the end- user response time is spent on

    the front-end. Start there.” - Steve Souders
  5. Compress • Photoshop is not good enough • TinyPNG, OptiPNG,

    ImageOptim, jpegtran • Use a WP plugin if needed
  6. Resize • Don’t make the browser resize images • Only

    load the size necessary for the current viewport • The new picture element and its attributes are great for this
  7. RICG Responsive Images WP Plugin • Yay, there’s a plugin

    for this! • https://wordpress.org/plugins/ricg-responsive- images/
  8. Concatenate & Minify • Serve as few JavaScript files as

    possible, by concatenating • Use Uglify to minify • Task runners work like magic for these tasks
  9. Load smart • Scripts go before closing <body> tag •

    Defer loading of JS where possible • loadJS • Use defer and async attributes
  10. CSS

  11. Concatenate & Minify • Serve as few CSS files as

    possible, by concatenating • Using Sass is beneficial • Compression (removing whitespace) • Task runners work like magic for these tasks
  12. Load smart • The foolproof way is to serve stylesheets

    in the head • However, this blocks the loading of other resources • Enter “critical CSS”
  13. • Styles that are needed for the first, above-the-fold view

    are inlined in the <head> • The full stylesheet is then loading asynchronously, not blocking the rest of the page (loadCSS is perfect for this) • critical by Addy Osmani • grunt-criticalcss by Filament Group Critical CSS
  14. Caching headers • Expires and max-age • Instructs the browser

    to load already downloaded assets • Tell the browser when to stop caching • Far Future Expiry Header WP plugin
  15. CDN

  16. CDN • Delivers content to the user from the closest

    and fastest server available • Your assets are hosted on a network of servers throughout the world
  17. “The duration from the user making an HTTP request to

    the first byte of the page being received by the browser”
  18. Plugins • Plugins can dramatically slow down your TTFB •

    Be cautious • Quantity is not bad, but poor quality is • Watch for database queries and complex operations • Watch for assets loaded by plugins • P3 Profiler