SlideShare une entreprise Scribd logo
1  sur  69
johnhrv@microsoft.com
Layout, Rende
            ring, Formattin
16%         g, …



            JScript & DOM
      84%
Layout, Rende
            ring, Formattin
            g, …
33%


      67%
            JScript & DOM
CSS performance
Optimizing symbol resolution
Javascript coding inefficiencies
HTTP performance
table tr td ul li {color: green;}
li#pass {color: green;}



ul li {color: purple;}
ul > li {color: purple;}
Minimize included styles
Use less-complicated selectors
Don’t use expressions
Minimize page re-layouts
CSS Performance
Optimizing Symbol Resolution
JavaScript Coding Inefficiencies
HTTP Performance
DOM
  Global

                      Prototype
Intermediate
                         …
     …         Cost

                      Instance
   Local
function WorkOnLocalVariable()
{
    localVariable = foo();
    return ( localVariable + 1 );
}
function WorkOnLocalVariable2()
{
    var localVariable = foo();
    return ( localVariable + 1 );
}
function BuildUI()
{
    var elm = document.getElementById('ui');

    // Clear existing contents
    elm.innerHTML = '';          7 innerHTML
                                  References
    // Generate UI
    elm.innerHTML += BuildTitle();
                   +=
    elm.innerHTML += BuildBody();
                   +=
    elm.innerHTML += BuildFooter();
                   +=
}
function BuildUI2()
{
    var elm = document.getElementById('ui');

                                    1 innerHTML
    // Generate UI
                                     Reference
    var contents = BuildTitle()
                 + BuildBody()
                 + BuildFooter();

    // Replace existing contents with UI
    elm.innerHTML = contents;
}
function CalculateSum()
{
    // Retrieve   Values
                  document.body.all
    var lSide =   document.body.all.lSide.value;
                  document.body.all
    var rSide =   document.body.all.rSide.value;

    // Generate Result
    document.body.all.result.value = lSide
    document.body.all
                                   + rSide;
}
function CalculateSum2()
{
    // Cache Element Collection
    var elms = document.body.all;

    // Retrieve   Values
                  elms
    var lSide =   elms.lSide.value;
                  elms
    var rSide =   elms.rSide.value;

    // Generate Result
    elms
    elms.result.value = lSide + rSide;
}
function IterateWorkOverCollection()
{
    var length = myCollection.length;

    for(var i = 0; i < length; i++)
    {
      Work
       Work(myCollection[i]);
    }
}
function IterateWorkOverCollection2()
{
    var funcWork = Work;
    var funcWork = Work;
    var length = myCollection.length;

    for(var i = 0; i < length; i++)
    {
      funcWork
       funcWork(myCollection[i]);
    }
}
http://channel9.msdn.com/pdc2008/TL24/
CSS Performance Considerations
Optimizing Symbol Resolution
JavaScript Coding Inefficiencies
HTTP Performance
http://wiki.ecmascript.org/doku.php?id=es3.1:json
_support
             http://www.json.org/json_parser.js
switch(option)
{
     case 1: …
     case 2: …
     case 3: …
     …
     case 1000: …
}
var lookup = {
      1: function(){…}
      2: function(){…}
      3: function(){…}
      …
      1000: function(){…}
}

try {
   lookup[option]();
  lookup [option]();
} catch(e) {
  // Default operation
}
var property = foo();

this.getProperty = function()
{
  return property;
}

this.setProperty = function(value)
{
  property = value;
}
this.property = foo();
DOM
  Global

                      Prototype
Intermediate
                         …
     …         Cost

                      Instance
   Local
DOM
  Global

                      Prototype
Intermediate
                         …
     …         Cost

                      Instance
   Local
Trident (MSHTML)

      DOM




 JScript Engine
function getElementsByClassName(className, node, tag) {
      …
      var elements = node.getElementsByTagName(tag);
      var elements = node.getElementsByTagName(tag);
      var pattern = new RegExp(quot;(^|s)quot; + className +
quot;(s|$)quot;);
                                elements.length
      for(var i = 0, j = 0; i < elements.length; i++) {
                             elements[i]
            if (pattern.test(elements[i].className)) {
                  classElements[j] = elements[i];
                    j++;
            }
      }
      return classElements;
}
function getElementsByClassName(className, node, tag)
{
      …
      var results = node.getElementsByTagName(tag);
      var elements = new Array(results.length);
      var elements = new Array(results.length);
      while (length--) elements[length] = results[length];
      while (length--) elements[length] = results[length];
      var pattern = new RegExp(quot;(^|s)quot; + className +
quot;(s|$)quot;);
      for(var i = 0, j = 0; i < elements.length i++) {
                                elements.length;
                             elements[i]
            if (pattern.test(elements[i].className)) {
                  classElements.push(results[i]);    j++;
  }
      } return classElements;
}
function LoopChildren(elm)
{
  var nodes = elm.childNodes;
  var length = nodes.length;

    for(var i = 0; i < length; i++)
    {
      var node = nodes[i];
                 nodes[i];
      …
    }
}
function LoopChildren2(elm)
{
  var node = elm.firstChild;

    while(node != null)
    {
      …
      node = node.nextSibling;
    }
}
function doValidation2()
{
   // Retrieve the required elements by using Selectors
   // Selects all form fields with 'required' classes
   var reqs = document.querySelectorAll
              document.querySelectorAll(quot;.requiredquot;);

    // Set the flag to false by default
    var missingRequiredField = false;

    // Validate that the form data is not empty
    for (var i = 0; i < reqs.length; i++) {
       if (reqs[i].value == quot;quot;)
         missingRequiredField = true;
    }
}
Use the native JSON object
Turn large switch statements into lookups
Avoid property access methods
Minimize DOM interaction
Use querySelectorAll for groups
CSS Performance
Optimizing Symbol Resolution
JavaScript Coding Inefficiencies
HTTP Performance
GET / HTTP/1.1                                   HTTP/1.1 200 OK
Accept: */*                                      Content-Length: 3479
Accept-Language: en-us                           Expires: -1
UA-CPU: x86                                      Date: Tue, 24 Apr 2007 21:30:46 GMT
                                                 Content-Type: text/html; charset=utf-8
Accept-Encoding: gzip, deflate
User-Agent: Mozilla/4.0 (compatible; MSIE 7.0)   Pragma: no-cache
Host: www.live.com                               Content-Encoding: gzip
                                                                    gzip
<html>
  <head>
     <title>Test</title>
  </head>
  <body>
     …
     <!-- icon.gif dimensions: 500 x 400 -->
     <img src=quot;icon.gifquot; width=quot;50quot; height=quot;40quot; />
     …
  </body>
</html>
<html>
  <head>
     <title>Test</title>
  </head>
  <body>
     …
     <!-- icon2.gif dimensions: 50 x 40 -->
     <img src=quot;icon2.gifquot; width=quot;50quot; height=quot;40quot; />
     …
  </body>
</html>
<html>
  <head>
     <title>Test</title>
     <script src=“1.js” … ></script>
     <script src= type=quot;text/javascriptquot;></script>
    <script src=“2.js” … ></script>
    <link href=“1.css” … ></link>
    <link href=“2.css” … ></link>
  </head>
  <body>
     …
  </body>
</html>
<html>
  <head>
     <title>Test</title>
     <script src=“1+2.js” … ></script>
     <script type=quot;text/javascriptquot;></script>
    <link href=“1+2.css” … ></link>

  </head>
  <body>
     …
  </body>
</html>
<html>
  <head>
     <title>Test</title>
  </head>
  <body>
     …
     <img src=quot;a.gifquot; />   Item 1
     <img src=quot;b.gifquot; />   Item 2
     …
  </body>
</html>
<head>
   <title>Test</title>
   <style type=quot;text/cssquot;>
       .a, .b { width: 10; height: 10 }
       .a, .b { background-image: quot;abc.gifquot; }
       .a { background-position: 0   0}
       .b { background-position: 0 -10 }
       .b { background-position: 0 -10 }
   </style>
</head>
<body>
   …
   <div class=quot;aquot;></div> Item 1
   <div class=quot;aquot;></div>
   <div class=quot;bquot;></div>
   <div class=quot;bquot;></div> Item 2
   …
</body>
Request                              Response
GET /images/banner.jpg HTTP/1.1      HTTP/1.1 304 Not Modified
Host: www.microsoft.com              Content-Type: image/jpeg
If-Modified-Since:                   Last-Modified:
     Wed, 22 Feb 2006 04:15:54 GMT        Wed, 22 Feb 2006 04:15:54 GMT
Request                           Response
GET /images/banner.jpg HTTP/1.1   HTTP/1.1 200 OK
Host: www.microsoft.com           Content-Type: image/jpeg
                                  Expires: Fri, 12 Jun 2009 02:50:50 GMT




Request                           Response
GET /images/banner.jpg HTTP/1.1

                                             No response:
                                             Request serviced from
                                             cache
<html>
  <head>
     <title>Test</title>
     <script src=“1+2.js” … ></script>
     <script type=quot;text/javascriptquot;></script>
  </head>
  <body>
     …
  </body>
</html>
<html>
  <head>
     <title>Test</title>
  </head>
  <body>
     …
     <script src=“1+2.js” … ></script>
  </body>
</html>
www.fiddler2.com



http://www.fiddler2.com/fiddler2/addons/neXper
t.asp
Your feedback is important!
© 2009 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries.
The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market
                                                                                                 conditions,
          it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation.
                                 MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

Contenu connexe

Tendances

Ten useful JavaScript tips & best practices
Ten useful JavaScript tips & best practicesTen useful JavaScript tips & best practices
Ten useful JavaScript tips & best practicesAnkit Rastogi
 
Backbone.js: Run your Application Inside The Browser
Backbone.js: Run your Application Inside The BrowserBackbone.js: Run your Application Inside The Browser
Backbone.js: Run your Application Inside The BrowserHoward Lewis Ship
 
Bubbles & Trees with jQuery
Bubbles & Trees with jQueryBubbles & Trees with jQuery
Bubbles & Trees with jQueryBastian Feder
 
Learning jQuery in 30 minutes
Learning jQuery in 30 minutesLearning jQuery in 30 minutes
Learning jQuery in 30 minutesSimon Willison
 
Powerful JavaScript Tips and Best Practices
Powerful JavaScript Tips and Best PracticesPowerful JavaScript Tips and Best Practices
Powerful JavaScript Tips and Best PracticesDragos Ionita
 
Zepto.js, a jQuery-compatible mobile JavaScript framework in 2K
Zepto.js, a jQuery-compatible mobile JavaScript framework in 2KZepto.js, a jQuery-compatible mobile JavaScript framework in 2K
Zepto.js, a jQuery-compatible mobile JavaScript framework in 2KThomas Fuchs
 
Performance Optimization and JavaScript Best Practices
Performance Optimization and JavaScript Best PracticesPerformance Optimization and JavaScript Best Practices
Performance Optimization and JavaScript Best PracticesDoris Chen
 
Designing with Groovy Traits - Gr8Conf India
Designing with Groovy Traits - Gr8Conf IndiaDesigning with Groovy Traits - Gr8Conf India
Designing with Groovy Traits - Gr8Conf IndiaNaresha K
 
Being functional in PHP (DPC 2016)
Being functional in PHP (DPC 2016)Being functional in PHP (DPC 2016)
Being functional in PHP (DPC 2016)David de Boer
 
Art of Javascript
Art of JavascriptArt of Javascript
Art of JavascriptTarek Yehia
 
Opaque Pointers Are Coming
Opaque Pointers Are ComingOpaque Pointers Are Coming
Opaque Pointers Are ComingNikita Popov
 
JavaScript and the AST
JavaScript and the ASTJavaScript and the AST
JavaScript and the ASTJarrod Overson
 
TDC2016SP - Trilha .NET
TDC2016SP - Trilha .NETTDC2016SP - Trilha .NET
TDC2016SP - Trilha .NETtdc-globalcode
 
PyCon APAC - Django Test Driven Development
PyCon APAC - Django Test Driven DevelopmentPyCon APAC - Django Test Driven Development
PyCon APAC - Django Test Driven DevelopmentTudor Munteanu
 
JSConf: All You Can Leet
JSConf: All You Can LeetJSConf: All You Can Leet
JSConf: All You Can Leetjohndaviddalton
 

Tendances (20)

Ten useful JavaScript tips & best practices
Ten useful JavaScript tips & best practicesTen useful JavaScript tips & best practices
Ten useful JavaScript tips & best practices
 
Dartprogramming
DartprogrammingDartprogramming
Dartprogramming
 
Backbone.js: Run your Application Inside The Browser
Backbone.js: Run your Application Inside The BrowserBackbone.js: Run your Application Inside The Browser
Backbone.js: Run your Application Inside The Browser
 
Bubbles & Trees with jQuery
Bubbles & Trees with jQueryBubbles & Trees with jQuery
Bubbles & Trees with jQuery
 
Learning jQuery in 30 minutes
Learning jQuery in 30 minutesLearning jQuery in 30 minutes
Learning jQuery in 30 minutes
 
Powerful JavaScript Tips and Best Practices
Powerful JavaScript Tips and Best PracticesPowerful JavaScript Tips and Best Practices
Powerful JavaScript Tips and Best Practices
 
Say It With Javascript
Say It With JavascriptSay It With Javascript
Say It With Javascript
 
Zepto.js, a jQuery-compatible mobile JavaScript framework in 2K
Zepto.js, a jQuery-compatible mobile JavaScript framework in 2KZepto.js, a jQuery-compatible mobile JavaScript framework in 2K
Zepto.js, a jQuery-compatible mobile JavaScript framework in 2K
 
jQuery introduction
jQuery introductionjQuery introduction
jQuery introduction
 
Performance Optimization and JavaScript Best Practices
Performance Optimization and JavaScript Best PracticesPerformance Optimization and JavaScript Best Practices
Performance Optimization and JavaScript Best Practices
 
Designing with Groovy Traits - Gr8Conf India
Designing with Groovy Traits - Gr8Conf IndiaDesigning with Groovy Traits - Gr8Conf India
Designing with Groovy Traits - Gr8Conf India
 
Being functional in PHP (DPC 2016)
Being functional in PHP (DPC 2016)Being functional in PHP (DPC 2016)
Being functional in PHP (DPC 2016)
 
ES2015 workflows
ES2015 workflowsES2015 workflows
ES2015 workflows
 
Art of Javascript
Art of JavascriptArt of Javascript
Art of Javascript
 
Opaque Pointers Are Coming
Opaque Pointers Are ComingOpaque Pointers Are Coming
Opaque Pointers Are Coming
 
JavaScript and the AST
JavaScript and the ASTJavaScript and the AST
JavaScript and the AST
 
The jQuery Divide
The jQuery DivideThe jQuery Divide
The jQuery Divide
 
TDC2016SP - Trilha .NET
TDC2016SP - Trilha .NETTDC2016SP - Trilha .NET
TDC2016SP - Trilha .NET
 
PyCon APAC - Django Test Driven Development
PyCon APAC - Django Test Driven DevelopmentPyCon APAC - Django Test Driven Development
PyCon APAC - Django Test Driven Development
 
JSConf: All You Can Leet
JSConf: All You Can LeetJSConf: All You Can Leet
JSConf: All You Can Leet
 

Similaire à Building High Performance Web Applications and Sites

the next web now
the next web nowthe next web now
the next web nowzulin Gu
 
Building High Perf Web Apps - IE8 Firestarter
Building High Perf Web Apps - IE8 FirestarterBuilding High Perf Web Apps - IE8 Firestarter
Building High Perf Web Apps - IE8 FirestarterMithun T. Dhar
 
Secrets of JavaScript Libraries
Secrets of JavaScript LibrariesSecrets of JavaScript Libraries
Secrets of JavaScript Librariesjeresig
 
The Beauty Of Java Script V5a
The Beauty Of Java Script V5aThe Beauty Of Java Script V5a
The Beauty Of Java Script V5arajivmordani
 
Building Robust jQuery Plugins
Building Robust jQuery PluginsBuilding Robust jQuery Plugins
Building Robust jQuery PluginsJörn Zaefferer
 
Lecture 03 - JQuery.pdf
Lecture 03 - JQuery.pdfLecture 03 - JQuery.pdf
Lecture 03 - JQuery.pdfLê Thưởng
 
#NewMeetup Performance
#NewMeetup Performance#NewMeetup Performance
#NewMeetup PerformanceJustin Cataldo
 
Modern JavaScript Programming
Modern JavaScript Programming Modern JavaScript Programming
Modern JavaScript Programming Wildan Maulana
 
JavaScript performance patterns
JavaScript performance patternsJavaScript performance patterns
JavaScript performance patternsStoyan Stefanov
 
eXo SEA - JavaScript Introduction Training
eXo SEA - JavaScript Introduction TrainingeXo SEA - JavaScript Introduction Training
eXo SEA - JavaScript Introduction TrainingHoat Le
 
jQuery Internals + Cool Stuff
jQuery Internals + Cool StuffjQuery Internals + Cool Stuff
jQuery Internals + Cool Stuffjeresig
 
JavaScript: Ajax & DOM Manipulation
JavaScript: Ajax & DOM ManipulationJavaScript: Ajax & DOM Manipulation
JavaScript: Ajax & DOM Manipulationborkweb
 
Enhance Web Performance
Enhance Web PerformanceEnhance Web Performance
Enhance Web PerformanceAdam Lu
 
Javascript first-class citizenery
Javascript first-class citizeneryJavascript first-class citizenery
Javascript first-class citizenerytoddbr
 
JavaScript Growing Up
JavaScript Growing UpJavaScript Growing Up
JavaScript Growing UpDavid Padbury
 
SenchaCon 2016: Building a Faceted Catalog of Video Game Assets Using Ext JS ...
SenchaCon 2016: Building a Faceted Catalog of Video Game Assets Using Ext JS ...SenchaCon 2016: Building a Faceted Catalog of Video Game Assets Using Ext JS ...
SenchaCon 2016: Building a Faceted Catalog of Video Game Assets Using Ext JS ...Sencha
 
Formatting ForThe Masses
Formatting ForThe MassesFormatting ForThe Masses
Formatting ForThe MassesHolger Schill
 
"Scala in Goozy", Alexey Zlobin
"Scala in Goozy", Alexey Zlobin "Scala in Goozy", Alexey Zlobin
"Scala in Goozy", Alexey Zlobin Vasil Remeniuk
 

Similaire à Building High Performance Web Applications and Sites (20)

the next web now
the next web nowthe next web now
the next web now
 
Building High Perf Web Apps - IE8 Firestarter
Building High Perf Web Apps - IE8 FirestarterBuilding High Perf Web Apps - IE8 Firestarter
Building High Perf Web Apps - IE8 Firestarter
 
Performance patterns
Performance patternsPerformance patterns
Performance patterns
 
Secrets of JavaScript Libraries
Secrets of JavaScript LibrariesSecrets of JavaScript Libraries
Secrets of JavaScript Libraries
 
The Beauty of Java Script
The Beauty of Java ScriptThe Beauty of Java Script
The Beauty of Java Script
 
The Beauty Of Java Script V5a
The Beauty Of Java Script V5aThe Beauty Of Java Script V5a
The Beauty Of Java Script V5a
 
Building Robust jQuery Plugins
Building Robust jQuery PluginsBuilding Robust jQuery Plugins
Building Robust jQuery Plugins
 
Lecture 03 - JQuery.pdf
Lecture 03 - JQuery.pdfLecture 03 - JQuery.pdf
Lecture 03 - JQuery.pdf
 
#NewMeetup Performance
#NewMeetup Performance#NewMeetup Performance
#NewMeetup Performance
 
Modern JavaScript Programming
Modern JavaScript Programming Modern JavaScript Programming
Modern JavaScript Programming
 
JavaScript performance patterns
JavaScript performance patternsJavaScript performance patterns
JavaScript performance patterns
 
eXo SEA - JavaScript Introduction Training
eXo SEA - JavaScript Introduction TrainingeXo SEA - JavaScript Introduction Training
eXo SEA - JavaScript Introduction Training
 
jQuery Internals + Cool Stuff
jQuery Internals + Cool StuffjQuery Internals + Cool Stuff
jQuery Internals + Cool Stuff
 
JavaScript: Ajax & DOM Manipulation
JavaScript: Ajax & DOM ManipulationJavaScript: Ajax & DOM Manipulation
JavaScript: Ajax & DOM Manipulation
 
Enhance Web Performance
Enhance Web PerformanceEnhance Web Performance
Enhance Web Performance
 
Javascript first-class citizenery
Javascript first-class citizeneryJavascript first-class citizenery
Javascript first-class citizenery
 
JavaScript Growing Up
JavaScript Growing UpJavaScript Growing Up
JavaScript Growing Up
 
SenchaCon 2016: Building a Faceted Catalog of Video Game Assets Using Ext JS ...
SenchaCon 2016: Building a Faceted Catalog of Video Game Assets Using Ext JS ...SenchaCon 2016: Building a Faceted Catalog of Video Game Assets Using Ext JS ...
SenchaCon 2016: Building a Faceted Catalog of Video Game Assets Using Ext JS ...
 
Formatting ForThe Masses
Formatting ForThe MassesFormatting ForThe Masses
Formatting ForThe Masses
 
"Scala in Goozy", Alexey Zlobin
"Scala in Goozy", Alexey Zlobin "Scala in Goozy", Alexey Zlobin
"Scala in Goozy", Alexey Zlobin
 

Plus de goodfriday

Narine Presentations 20051021 134052
Narine Presentations 20051021 134052Narine Presentations 20051021 134052
Narine Presentations 20051021 134052goodfriday
 
09 03 22 easter
09 03 22 easter09 03 22 easter
09 03 22 eastergoodfriday
 
Holy Week Easter 2009
Holy Week Easter 2009Holy Week Easter 2009
Holy Week Easter 2009goodfriday
 
Holt Park Easter 09 Swim
Holt Park Easter 09 SwimHolt Park Easter 09 Swim
Holt Park Easter 09 Swimgoodfriday
 
Swarthmore Lentbrochure20092
Swarthmore Lentbrochure20092Swarthmore Lentbrochure20092
Swarthmore Lentbrochure20092goodfriday
 
Eastercard2009
Eastercard2009Eastercard2009
Eastercard2009goodfriday
 
Easterservices2009
Easterservices2009Easterservices2009
Easterservices2009goodfriday
 
Bulletin Current
Bulletin CurrentBulletin Current
Bulletin Currentgoodfriday
 
March 2009 Newsletter
March 2009 NewsletterMarch 2009 Newsletter
March 2009 Newslettergoodfriday
 
Lent Easter 2009
Lent Easter 2009Lent Easter 2009
Lent Easter 2009goodfriday
 
Easterpowersports09
Easterpowersports09Easterpowersports09
Easterpowersports09goodfriday
 
Easter Trading 09
Easter Trading 09Easter Trading 09
Easter Trading 09goodfriday
 
Easter Brochure 2009
Easter Brochure 2009Easter Brochure 2009
Easter Brochure 2009goodfriday
 
March April 2009 Calendar
March April 2009 CalendarMarch April 2009 Calendar
March April 2009 Calendargoodfriday
 

Plus de goodfriday (20)

Narine Presentations 20051021 134052
Narine Presentations 20051021 134052Narine Presentations 20051021 134052
Narine Presentations 20051021 134052
 
Triunemar05
Triunemar05Triunemar05
Triunemar05
 
09 03 22 easter
09 03 22 easter09 03 22 easter
09 03 22 easter
 
Holy Week Easter 2009
Holy Week Easter 2009Holy Week Easter 2009
Holy Week Easter 2009
 
Holt Park Easter 09 Swim
Holt Park Easter 09 SwimHolt Park Easter 09 Swim
Holt Park Easter 09 Swim
 
Easter Letter
Easter LetterEaster Letter
Easter Letter
 
April2009
April2009April2009
April2009
 
Swarthmore Lentbrochure20092
Swarthmore Lentbrochure20092Swarthmore Lentbrochure20092
Swarthmore Lentbrochure20092
 
Eastercard2009
Eastercard2009Eastercard2009
Eastercard2009
 
Easterservices2009
Easterservices2009Easterservices2009
Easterservices2009
 
Bulletin Current
Bulletin CurrentBulletin Current
Bulletin Current
 
Easter2009
Easter2009Easter2009
Easter2009
 
Bulletin
BulletinBulletin
Bulletin
 
March 2009 Newsletter
March 2009 NewsletterMarch 2009 Newsletter
March 2009 Newsletter
 
Mar 29 2009
Mar 29 2009Mar 29 2009
Mar 29 2009
 
Lent Easter 2009
Lent Easter 2009Lent Easter 2009
Lent Easter 2009
 
Easterpowersports09
Easterpowersports09Easterpowersports09
Easterpowersports09
 
Easter Trading 09
Easter Trading 09Easter Trading 09
Easter Trading 09
 
Easter Brochure 2009
Easter Brochure 2009Easter Brochure 2009
Easter Brochure 2009
 
March April 2009 Calendar
March April 2009 CalendarMarch April 2009 Calendar
March April 2009 Calendar
 

Dernier

Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native ApplicationsWSO2
 
WSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2
 
Six Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal OntologySix Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal Ontologyjohnbeverley2021
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdfSandro Moreira
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Angeliki Cooney
 
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​Bhuvaneswari Subramani
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FMESafe Software
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Victor Rentea
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAndrey Devyatkin
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FMESafe Software
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...apidays
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsNanddeep Nachan
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamUiPathCommunity
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxRustici Software
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDropbox
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...apidays
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingEdi Saputra
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoffsammart93
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...apidays
 

Dernier (20)

Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
WSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering Developers
 
Six Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal OntologySix Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal Ontology
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
 
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 

Building High Performance Web Applications and Sites

  • 1.
  • 2.
  • 3.
  • 5.
  • 6.
  • 7. Layout, Rende ring, Formattin 16% g, … JScript & DOM 84%
  • 8. Layout, Rende ring, Formattin g, … 33% 67% JScript & DOM
  • 9.
  • 10. CSS performance Optimizing symbol resolution Javascript coding inefficiencies HTTP performance
  • 11.
  • 12.
  • 13. table tr td ul li {color: green;} li#pass {color: green;} ul li {color: purple;} ul > li {color: purple;}
  • 14.
  • 15.
  • 16.
  • 17. Minimize included styles Use less-complicated selectors Don’t use expressions Minimize page re-layouts
  • 18. CSS Performance Optimizing Symbol Resolution JavaScript Coding Inefficiencies HTTP Performance
  • 19. DOM Global Prototype Intermediate … … Cost Instance Local
  • 20. function WorkOnLocalVariable() { localVariable = foo(); return ( localVariable + 1 ); }
  • 21. function WorkOnLocalVariable2() { var localVariable = foo(); return ( localVariable + 1 ); }
  • 22. function BuildUI() { var elm = document.getElementById('ui'); // Clear existing contents elm.innerHTML = ''; 7 innerHTML References // Generate UI elm.innerHTML += BuildTitle(); += elm.innerHTML += BuildBody(); += elm.innerHTML += BuildFooter(); += }
  • 23. function BuildUI2() { var elm = document.getElementById('ui'); 1 innerHTML // Generate UI Reference var contents = BuildTitle() + BuildBody() + BuildFooter(); // Replace existing contents with UI elm.innerHTML = contents; }
  • 24. function CalculateSum() { // Retrieve Values document.body.all var lSide = document.body.all.lSide.value; document.body.all var rSide = document.body.all.rSide.value; // Generate Result document.body.all.result.value = lSide document.body.all + rSide; }
  • 25. function CalculateSum2() { // Cache Element Collection var elms = document.body.all; // Retrieve Values elms var lSide = elms.lSide.value; elms var rSide = elms.rSide.value; // Generate Result elms elms.result.value = lSide + rSide; }
  • 26. function IterateWorkOverCollection() { var length = myCollection.length; for(var i = 0; i < length; i++) { Work Work(myCollection[i]); } }
  • 27. function IterateWorkOverCollection2() { var funcWork = Work; var funcWork = Work; var length = myCollection.length; for(var i = 0; i < length; i++) { funcWork funcWork(myCollection[i]); } }
  • 28.
  • 29.
  • 30.
  • 32. CSS Performance Considerations Optimizing Symbol Resolution JavaScript Coding Inefficiencies HTTP Performance
  • 33.
  • 35.
  • 36. switch(option) { case 1: … case 2: … case 3: … … case 1000: … }
  • 37. var lookup = { 1: function(){…} 2: function(){…} 3: function(){…} … 1000: function(){…} } try { lookup[option](); lookup [option](); } catch(e) { // Default operation }
  • 38. var property = foo(); this.getProperty = function() { return property; } this.setProperty = function(value) { property = value; }
  • 40.
  • 41. DOM Global Prototype Intermediate … … Cost Instance Local
  • 42. DOM Global Prototype Intermediate … … Cost Instance Local
  • 43. Trident (MSHTML) DOM JScript Engine
  • 44. function getElementsByClassName(className, node, tag) { … var elements = node.getElementsByTagName(tag); var elements = node.getElementsByTagName(tag); var pattern = new RegExp(quot;(^|s)quot; + className + quot;(s|$)quot;); elements.length for(var i = 0, j = 0; i < elements.length; i++) { elements[i] if (pattern.test(elements[i].className)) { classElements[j] = elements[i]; j++; } } return classElements; }
  • 45. function getElementsByClassName(className, node, tag) { … var results = node.getElementsByTagName(tag); var elements = new Array(results.length); var elements = new Array(results.length); while (length--) elements[length] = results[length]; while (length--) elements[length] = results[length]; var pattern = new RegExp(quot;(^|s)quot; + className + quot;(s|$)quot;); for(var i = 0, j = 0; i < elements.length i++) { elements.length; elements[i] if (pattern.test(elements[i].className)) { classElements.push(results[i]); j++; } } return classElements; }
  • 46.
  • 47. function LoopChildren(elm) { var nodes = elm.childNodes; var length = nodes.length; for(var i = 0; i < length; i++) { var node = nodes[i]; nodes[i]; … } }
  • 48. function LoopChildren2(elm) { var node = elm.firstChild; while(node != null) { … node = node.nextSibling; } }
  • 49. function doValidation2() { // Retrieve the required elements by using Selectors // Selects all form fields with 'required' classes var reqs = document.querySelectorAll document.querySelectorAll(quot;.requiredquot;); // Set the flag to false by default var missingRequiredField = false; // Validate that the form data is not empty for (var i = 0; i < reqs.length; i++) { if (reqs[i].value == quot;quot;) missingRequiredField = true; } }
  • 50. Use the native JSON object Turn large switch statements into lookups Avoid property access methods Minimize DOM interaction Use querySelectorAll for groups
  • 51. CSS Performance Optimizing Symbol Resolution JavaScript Coding Inefficiencies HTTP Performance
  • 52.
  • 53. GET / HTTP/1.1 HTTP/1.1 200 OK Accept: */* Content-Length: 3479 Accept-Language: en-us Expires: -1 UA-CPU: x86 Date: Tue, 24 Apr 2007 21:30:46 GMT Content-Type: text/html; charset=utf-8 Accept-Encoding: gzip, deflate User-Agent: Mozilla/4.0 (compatible; MSIE 7.0) Pragma: no-cache Host: www.live.com Content-Encoding: gzip gzip
  • 54. <html> <head> <title>Test</title> </head> <body> … <!-- icon.gif dimensions: 500 x 400 --> <img src=quot;icon.gifquot; width=quot;50quot; height=quot;40quot; /> … </body> </html>
  • 55. <html> <head> <title>Test</title> </head> <body> … <!-- icon2.gif dimensions: 50 x 40 --> <img src=quot;icon2.gifquot; width=quot;50quot; height=quot;40quot; /> … </body> </html>
  • 56. <html> <head> <title>Test</title> <script src=“1.js” … ></script> <script src= type=quot;text/javascriptquot;></script> <script src=“2.js” … ></script> <link href=“1.css” … ></link> <link href=“2.css” … ></link> </head> <body> … </body> </html>
  • 57. <html> <head> <title>Test</title> <script src=“1+2.js” … ></script> <script type=quot;text/javascriptquot;></script> <link href=“1+2.css” … ></link> </head> <body> … </body> </html>
  • 58. <html> <head> <title>Test</title> </head> <body> … <img src=quot;a.gifquot; /> Item 1 <img src=quot;b.gifquot; /> Item 2 … </body> </html>
  • 59. <head> <title>Test</title> <style type=quot;text/cssquot;> .a, .b { width: 10; height: 10 } .a, .b { background-image: quot;abc.gifquot; } .a { background-position: 0 0} .b { background-position: 0 -10 } .b { background-position: 0 -10 } </style> </head> <body> … <div class=quot;aquot;></div> Item 1 <div class=quot;aquot;></div> <div class=quot;bquot;></div> <div class=quot;bquot;></div> Item 2 … </body>
  • 60.
  • 61. Request Response GET /images/banner.jpg HTTP/1.1 HTTP/1.1 304 Not Modified Host: www.microsoft.com Content-Type: image/jpeg If-Modified-Since: Last-Modified: Wed, 22 Feb 2006 04:15:54 GMT Wed, 22 Feb 2006 04:15:54 GMT
  • 62. Request Response GET /images/banner.jpg HTTP/1.1 HTTP/1.1 200 OK Host: www.microsoft.com Content-Type: image/jpeg Expires: Fri, 12 Jun 2009 02:50:50 GMT Request Response GET /images/banner.jpg HTTP/1.1 No response: Request serviced from cache
  • 63. <html> <head> <title>Test</title> <script src=“1+2.js” … ></script> <script type=quot;text/javascriptquot;></script> </head> <body> … </body> </html>
  • 64. <html> <head> <title>Test</title> </head> <body> … <script src=“1+2.js” … ></script> </body> </html>
  • 66.
  • 67.
  • 68. Your feedback is important!
  • 69. © 2009 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.