SlideShare a Scribd company logo
NEW PERSPECTIVES
ON PERFORMANCE
     @mennovanslooten
  jQuery San Francisco 2012
HI, I’M MENNO



•I   live in The Netherlands

•I   make websites for http://www.aanzee.nl
Can you improve the
performance of this page?
A RACE CAR DRIVER
PILLARS OF PERFORMANCE


• Visibility

• Interactivity

• Responsiveness
Before you start optimizing...
ESTABLISH A BASELINE


• Measurable

• Repeatable

• Stable
Tip: Always focus first on
    low-hanging fruit
PILLAR 1:
        VISIBILITY
Going from about:blank to a styled web page
PILLAR 1: VISIBILITY



• Read  High Performance Web
 Sites by Steve Souders
PILLAR 1: VISIBILITY


• Install   Firebug and YSlow

• Do   whatever YSlow tells you (if you can do it in a day)

• Don’t     worry too much about the rest
Tip: Crowdsource your
  measurements with
   Google Analytics
<html>
    <head>
        <script>
	 	 	 	 	 __START__ = new Date;
	 	 	 	 </script>



$.ready(function() {
    var time = new Date - __START__;
    _gaq.push(
        '_trackEvent',
        'performance', 'dom_ready', '',
        time, true
    );
}
Tip: 8-bit PNG’s with alpha:
 http://www.8bitalpha.com/
PILLAR 2:
 INTERACTIVITY
Going from visible and styled to fully clickable
PILLAR 2: INTERACTIVITY



• Read Even Faster Web Sites
 by Steve Souders et al.
Tip: profile your $.ready()
// Don’t do this:
$.ready(function() {
    whatever_happens();
    here();
}

// to this:
$.ready(function() {
    console.profile();
    whatever_happens();
    here();
    console.profileEnd();
}
Tip: delay initialization
// Immediate init
$.ready(function() {
    function init() {
        // Do lots of stuff with #form
    }
    init();
});

// Delayed init
$.ready(function() {
    function init() {
        // Do lots of stuff with #form
    }
    $('#form').one('mouseenter', init);
});
PILLAR 3:
RESPONSIVENESS
Going from user action to visual feedback
PILLAR 3: RESPONSIVENESS



• Read High Performance
 JavaScript by Nicholas Zakas
Tip: throttle/debounce events
http://benalman.com/projects/jquery-throttle-debounce-plugin/
// Don’t do this:
$(‘input’).on(‘keydown’, someHandler);

// Do this:
$(‘input’).on(‘keydown’,
    $.debounce(500, someHandler));
// Don’t do this:
$(‘body’).on(‘mousemove’, someHandler);

// Do this:
$(‘body’).on(‘mousemove’,
    $.throttle(500, someHandler));
New Perspectives on Performance
Tip: this one is easiest to fake
NEW PERSPECTIVES
Performance optimizations
      are expensive
Performance optimizations
    can increase costs
THEM
ME
PHOTOGRAPHS


• http://www.flickr.com/photos/thehenryford/4929428611/

• http://www.flickr.com/photos/thehenryford/4930039724/

• http://www.flickr.com/photos/proctorarchives/6831872685/
THANK YOU
          menno.vanslooten@gmail.com
              @mennovanslooten




Thanks to Aan Zee (http://www.aanzee.nl) and the jQuery Foundation

More Related Content

PDF
The Onion
PDF
jQuery Conference San Diego 2014 - Web Performance
PPTX
jQuery Conference Austin Sept 2013
PDF
jQuery Keynote - Fall 2010
PDF
jQuery Chicago 2014 - Next-generation JavaScript Testing
PPTX
jQuery Conference Chicago - September 2014
KEY
Rapid Testing, Rapid Development
PPTX
jQuery Conference 2012 keynote
The Onion
jQuery Conference San Diego 2014 - Web Performance
jQuery Conference Austin Sept 2013
jQuery Keynote - Fall 2010
jQuery Chicago 2014 - Next-generation JavaScript Testing
jQuery Conference Chicago - September 2014
Rapid Testing, Rapid Development
jQuery Conference 2012 keynote

What's hot (20)

PPTX
HTTP 2.0 - Web Unleashed 2015
PDF
Beyond DOM Manipulations: Building Stateful Modules with Events and Promises
PPTX
Don't Over-React - just use Vue!
KEY
Sizzle jQCon San Francisco 2012
PDF
WordPress 2017 with VueJS and GraphQL
PDF
PrairieDevCon 2014 - Web Doesn't Mean Slow
PDF
jQueryTO: State of jQuery March 2013
PDF
Real World Web components
PPTX
Automated perf optimization - jQuery Conference
PDF
Drupal point of vue
PPT
AngularJS for Legacy Apps
PDF
React Walk-Thru - Santa Cruz JS, May 2015
PDF
Vuejs for Angular developers
PDF
Tek 2013 - Building Web Apps from a New Angle with AngularJS
PDF
Nuxt.JS Introdruction
PPT
Vue.js Getting Started
PDF
Going Node.js at Netflix
PDF
The Point of Vue - Intro to Vue.js
PDF
Wulin kungfu final
PDF
Transforming Front-End Disaster Code™ Into A Maintainable Masterpiece
HTTP 2.0 - Web Unleashed 2015
Beyond DOM Manipulations: Building Stateful Modules with Events and Promises
Don't Over-React - just use Vue!
Sizzle jQCon San Francisco 2012
WordPress 2017 with VueJS and GraphQL
PrairieDevCon 2014 - Web Doesn't Mean Slow
jQueryTO: State of jQuery March 2013
Real World Web components
Automated perf optimization - jQuery Conference
Drupal point of vue
AngularJS for Legacy Apps
React Walk-Thru - Santa Cruz JS, May 2015
Vuejs for Angular developers
Tek 2013 - Building Web Apps from a New Angle with AngularJS
Nuxt.JS Introdruction
Vue.js Getting Started
Going Node.js at Netflix
The Point of Vue - Intro to Vue.js
Wulin kungfu final
Transforming Front-End Disaster Code™ Into A Maintainable Masterpiece
Ad

Similar to New Perspectives on Performance (20)

PDF
Plugging into plugins
PDF
The Art of AngularJS in 2015
PDF
Max Voloshin - "Organization of frontend development for products with micros...
PPTX
Introduction to Angular
PPTX
Good karma: UX Patterns and Unit Testing in Angular with Karma
KEY
5 Tips for Writing Better JavaScript
PDF
Comparing Hot JavaScript Frameworks: AngularJS, Ember.js and React.js - Sprin...
PPTX
AppForum 2014 Boost Hybrid App Performance
PDF
Hybrid Tips & Tricks
PDF
Mobile App Feature Configuration and A/B Experiments
PDF
Optimizely Developer Showcase
PDF
Introduction to Using PHP & MVC Frameworks
PDF
GCPUG meetup 201610 - Dataflow Introduction
PPTX
10 Things Every Plugin Developer Should Know (WordCamp Atlanta 2013)
PDF
Now you see me... Adaptive Web Design and Development
PDF
Being Epic: Best Practices for Android Development
KEY
Taking your Web App for a walk
PDF
From Idea to App (or “How we roll at Small Town Heroes”)
PDF
Writing JavaScript that doesn't suck
PDF
Javascript essential-pattern
Plugging into plugins
The Art of AngularJS in 2015
Max Voloshin - "Organization of frontend development for products with micros...
Introduction to Angular
Good karma: UX Patterns and Unit Testing in Angular with Karma
5 Tips for Writing Better JavaScript
Comparing Hot JavaScript Frameworks: AngularJS, Ember.js and React.js - Sprin...
AppForum 2014 Boost Hybrid App Performance
Hybrid Tips & Tricks
Mobile App Feature Configuration and A/B Experiments
Optimizely Developer Showcase
Introduction to Using PHP & MVC Frameworks
GCPUG meetup 201610 - Dataflow Introduction
10 Things Every Plugin Developer Should Know (WordCamp Atlanta 2013)
Now you see me... Adaptive Web Design and Development
Being Epic: Best Practices for Android Development
Taking your Web App for a walk
From Idea to App (or “How we roll at Small Town Heroes”)
Writing JavaScript that doesn't suck
Javascript essential-pattern
Ad

Recently uploaded (20)

PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PDF
Chapter 3 Spatial Domain Image Processing.pdf
PDF
KodekX | Application Modernization Development
PDF
cuic standard and advanced reporting.pdf
PPTX
Cloud computing and distributed systems.
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
PDF
Modernizing your data center with Dell and AMD
PPTX
Big Data Technologies - Introduction.pptx
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
PDF
NewMind AI Monthly Chronicles - July 2025
PPTX
PA Analog/Digital System: The Backbone of Modern Surveillance and Communication
PDF
Machine learning based COVID-19 study performance prediction
PDF
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
PPT
Teaching material agriculture food technology
PDF
Empathic Computing: Creating Shared Understanding
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PPTX
Understanding_Digital_Forensics_Presentation.pptx
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
Chapter 3 Spatial Domain Image Processing.pdf
KodekX | Application Modernization Development
cuic standard and advanced reporting.pdf
Cloud computing and distributed systems.
Advanced methodologies resolving dimensionality complications for autism neur...
Modernizing your data center with Dell and AMD
Big Data Technologies - Introduction.pptx
Building Integrated photovoltaic BIPV_UPV.pdf
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
NewMind AI Monthly Chronicles - July 2025
PA Analog/Digital System: The Backbone of Modern Surveillance and Communication
Machine learning based COVID-19 study performance prediction
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
Reach Out and Touch Someone: Haptics and Empathic Computing
Teaching material agriculture food technology
Empathic Computing: Creating Shared Understanding
Per capita expenditure prediction using model stacking based on satellite ima...
Understanding_Digital_Forensics_Presentation.pptx

New Perspectives on Performance

Editor's Notes

  • #2: \n
  • #3: The only obstacle between you and a couple of cold beers\nI know it&amp;#x2019;s been a long day of complex material\nDon&amp;#x2019;t worry, timed to about 25 minutes. As mentally challenging as Dora the Explorer\nBefore I get started I&amp;#x2019;d like to get to know you a little better\nBy show of hands, who here has ever received this simple request\n
  • #4: So many of you have heard this. The rest will down the line. \nSuch a simple question but so hard to answer correctly\nThrough this presentation I&amp;#x2019;d like to give you some tools to deal with it\nIdeas about how to approach the problem\nAnd some tips to help you identify the issues\nFirst, imagine this scenario\n
  • #5: \nJust asking for better performance is silly. Engineers are not magicians.\nAcceleration, top speed, handling in corners\nYou could call these the pillars of a race car&amp;#x2019;s performance\n
  • #6: In my experience, these are the three attributes that define a web page&amp;#x2019;s performance\nI will briefly go over each of them\n
  • #7: Now, I realize you want to get right down to business. \nStart fixing stuff, start improving code.\nDon&amp;#x2019;t.\nThere&amp;#x2019;s a couple of really important things that need to be taken care of\nFirst you need to establish a base line\n
  • #8: Measurable: you can express it in a number. time or operations\nRepeatable: these numbers don&amp;#x2019;t vary wildly between tests\nif your performance varies a lot, you don&apos;t have performance issues, you have a bug.\nStable: It&amp;#x2019;s safe to make changes because of automated testing\nAnd then: gather data on as many different platforms as possible\nThis data is your baseline.\n
  • #9: Don&amp;#x2019;t climb the tree for a coconut when there&amp;#x2019;s a banana right in front of you.\nUnless you really like coconuts.\nOr climbing.\n
  • #10: Simply said: how long does it take to look good?\n\n
  • #11: I know this is a cop-out but there&apos;s just too much good stuff in there.\nIt really is required reading.\nI do have some stuff to add\n
  • #12: Yahoo&amp;#x2019;s YSlow, or Google&amp;#x2019;s PageSpeed are tools that analyze your web page.\nVery useful tools in determining the low hanging fruit I was talking about earlier.\nBe careful though, because they also point out coconuts. \nBefore you know it you&amp;#x2019;re climbing a tree.\n\n
  • #13: Brace yourself. Code is coming.\n
  • #14: Google will save all the events and average the data.\nSee how long your average user takes.\nInclude this in your baseline.\n
  • #15: Simply said: 256-color PNG&apos;s with Alpha channel.\nDepending on how crazy your graphic designer is this can save 100s of KB\n
  • #16: Mostly dependent on what scripts are loaded and run\nFor jQuery projects, much of this will be in a $.ready() handler.\n
  • #17: For this sequel they really pulled out an all-star cast and it&apos;s just as gripping as the first one.\nI hear he&apos;s working on &quot;Faster Web sites Strike Back&quot;\n\n\n
  • #18: \n
  • #19: \n
  • #20: Initialize on first click\nCheck out Doug&amp;#x2019;s presentation tomorrow on contextual jquery\n
  • #21: \n
  • #22: \n
  • #23: In my experience the hardest to do right\nThe hardest to get significant results\nI can think of only one low-hanging fruit: repeating events\n
  • #24: Some events fire once in a while, like click events, or even mouse hover\nOthers fire a lot like a keydown event in an input\nOthers still, fire all the time\nThe last 2 categories benefit a lot from either throttling or debouncing\nThrottling: once every x milliseconds, useful for drag or resizing\nDebouncing: once before/after a series, useful for keyboard\n\n
  • #25: \n
  • #26: \n
  • #27: \n
  • #28: Responsiveness is quite easy to fake\nAll you have to do is give immediate visual feedback before doing something heavy\nSpinners, progress bars, animations, anything to show that something is happening.\n\n
  • #29: These 3 pillars are all different aspects of a web page&amp;#x2019;s performance but there is one thing that binds them:\nThey are from the user&amp;#x2019;s perspective\nBut there are other perspectives, like the business perspective. \nThere could be money involved\n
  • #30: Improving performance is a time-consuming iterative process\nLot&amp;#x2019;s of trial and error and testing and comparing\nThere is a lot to lose and little to gain. \nThe most important gain is user happiness\nBut there are other ways to improve that,\nPerformance optimizations are relatively invisible\n
  • #31: I&amp;#x2019;ve seen performance improvements that took one man 2 days to write\nand caused bugs that took weeks to fix in total\nunit tests will only catch so much. \nand don&amp;#x2019;t forget about maintainability. the better it performs the least flexible it probably is.\nI realize this may all sound blasphemous. Didn&amp;#x2019;t I just recommend books by famous yahoo &amp; google devs?\nI did, and I stand by that.\n\n\n
  • #32: They are the cream of the crop devs\nworking on projects where every ms and every kb is multiplied by millions and millions of users\nNo wonder they care so much about it\nMe? I&apos;m more this guy\n
  • #33: \nDoesn&amp;#x2019;t mean I can&amp;#x2019;t learn from them. Just need to weigh costs and benefits of their recommendations\nThe race car&amp;#x2019;s goal is not to drive fast but to win races.\nOur websites have goals as well. Provide info, user perform task, sometimes not clear.\nWebsite&amp;#x2019;s performance measured in how well it achieves those goals\nIt&apos;s about our performance, how well are we doing our job.\nAre we building web sites the world needs. Or are we just making them fast?\n
  • #34: \n
  • #35: \n