Performance
first

Evan Willhite

Senior Developer
Centresource


WHY?

People like Money


every 100 ms increase in load time of Amazon.com decreased sales by 1%


a change in a 10-result page loading in 0.4 seconds to a 30-result page loading in 0.9 seconds decreased traffic and ad revenues by 20%



http://www.peer1.com/knowledgebase/how-slow-website-impacts-your-visitors-and-sales

RESPONSIVE ≠ magic


86% of responsive sites send about the same hefty payload to small screens as they do to large screens...

... page weight overall is on the rise -- Brad Frost




http://bradfrostweb.com/blog/post/prioritizing-performance-in-responsive-design/

Our JOB


80-90% of the end-user response time is spent on the frontend.   -- Steve Souders





http://www.stevesouders.com/blog/2012/02/10/the-performance-golden-rule/

HOW?

ASSETs

CodE

RENDERING

Assets

Assets

the Problem: Browsers can only load X* at a time

  1. Images (and Fonts)
  2. CSS/JS
  3. Server-side (don't be scared)

CODE

Code - CSS

The problem: bloat
  1. CSS Best Practices
    • Specific = fast, Descendants = slow (3 or less)
    • Key selector specificity (header a)
    • Group like styles
    • Proper ID usage
    • Leverage inheritance on parent selectors
  2. If you use preprocessors (SASS/LESS), beware output

https://developers.google.com/speed/docs/best-practices/rendering
https://developer.mozilla.org/en-US/docs/Web/Guide/CSS/Writing_efficient_CSS
http://csswizardry.com/2011/09/writing-efficient-css-selectors/

CODE - JS

  1. Less libraries (and latest versions)
  2. IDS vs. classes*
  3. CSS3 animations vs. JS animations*
  4. Minify - https://drupal.org/project/speedy
  5. Print at bottom of page - https://drupal.org/project/mothership
  6. Defer/async loading




https://developers.google.com/speed/articles/optimizing-javascript
http://coding.smashingmagazine.com/2012/11/05/writing-fast-memory-efficient-javascript/

RENDERING

RENDERing

Network - Measure Requests


RENDERing

Timelines - frame rate



Key: 60FPS or higher

RENDERing

Profiles: Measure JS/CSS/memory Performance


MY Drupal launch Checklist

  1. Theme/module purge from dev stage
  2. Disable unused modules and disable UI/dev ones
  3. Clean log
  4. Enable aggregation (admin/config/development/performance)
  5. Mothership: disable dev tools, enable single file css/js, CDN jQuery
  6. Install/enable Speedy
  7. Install/enable ImageAPI Optimize and optimize theme images
  8. Responsive Image solution - Mobify

Drupal 8 CHanges

  1. More control over js (load none)
  2. namespacing of Drupal(.js)
  3. #attach instead of drupal_add_*
  4. CSS/JS aggregation more controlled
  5. more dependency on localstorage/client-side caching for personalization

Learn Yoself








Questions?


Performance First

By Evan Willhite