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

Optimize or Die Tryin'

Optimize or Die Tryin'

This talk was made at Blend Conference (Lyon, October 1st and 2nd 2013).
It covers a simple process to optimize your page loading.

Damian Le Nouaille

October 01, 2013
Tweet

More Decks by Damian Le Nouaille

Other Decks in Programming

Transcript

  1. Optimize or Die Tryin’ Damian Le Nouaille CTO at Geeksters,

    Prof’ IngéSup, HashtagBattle @damln
  2. Frustration: Indirect Performance • Not visible in development • Fast

    computers • Very fast Internet access • localhost Oh it’s fast! Look at my computer. PS: You’re not the end user.
  3. Plan • Images • Concatenation • Minification • Compression •

    Versionning • Async • Share Buttons • Extra
  4. Images: format, size and optimisazion • Choose the format: PNG

    8-24 bits? JPEG? • Right size: 800x600 for a thumbnail? • Paint: width + height on <img> • ImageOptim, remove meta-data, reduce image weight • No images: Fonts or SVG (for icons)
  5. Concatenation Goal: • Reduce number of requests Tools: • Sass

    : use partials for CSS • Grunt (grunt-contrib-concat) : Combine JavaScript files in the right order
  6. Minification Goal: • Reduce the weight of the request Tools:

    • Sass : ouputFormat :compressed • Grunt : grunt-contrib-uglify
  7. Compression (Gzip) Goal: • Reduce the weight of the request,

    even MORE Why: • It’s easy to compress text • Good support (IE8+)
  8. Versionning: Cache Busting Goal: • Don’t GET existing assets Basics:

    • Rename assets (with MD5) • HTTP header : max-age=30000000
  9. “It works for me” • “Hi Bob, I upload the

    latest modifications.” • “I don’t see them, I have an old version.” • “Aaahhhhrrrrgffgg” Bob’s iPad is crap. NO!
  10. Async loading Goal: • Accelerate the DOM Load • Provide

    visual feedback to visitor Where: • Images • JavaScript
  11. Async load: Images How: • Change the source: src=”load.gif” •

    Add: data-src=”image.jpg” • Use a plugin to replace src by data-src • Unveil.js
  12. Async load: JavaScript How: • Use head.js • Declare the

    files • Use the callback • NO AMD • DEAD SIMPLE
  13. Share Buttons • Facebook likes, Tweet button, etc • Useless

    for the rendering • Trigger load at the right time Plugins: • Socialite • AddThis • Sharrre
  14. Extra • Sprite CSS : Compass • CDN : Latency

    / Mobile • Turbolinks : PJAX evolution Tools et readings : • YSlow • Page Speed Insights : Online + Chrome • Guides : Yahoo et Google
  15. Recap’ Source Concat Min Cache Hash Gzip Async 160 Ko

    111 Ko 88 Ko 88 Ko 16 Ko MD5 Development Server Client