SlideShare a Scribd company logo
1 of 46
Download to read offline
Performance
 Improvements in
    Browsers
                  John Resig
http://ejohn.org/ - http://twitter.com/jeresig/
About Me
✦   Work for the Mozilla Corporation (Firefox!)
    ✦ Do a lot of JavaScript performance analysis
    ✦ Dromaeo.com is my performance test suite
      ✦ Tests the performance of JavaScript engines
      ✦ Tests the performance of browser DOM
    ✦ Work on Firebug (great developer tool)

✦   Creator of the jQuery JavaScript Library
    ✦ http://jquery.com/
    ✦ Used by Microsoft, Google, Adobe, Nokia,
      IBM, Intel, CBS News, NBC, etc.
Upcoming Browsers
✦   The browsers:
    ✦ Firefox 3.1
    ✦ Safari 4
    ✦ Internet Explorer 8
    ✦ Opera 10
    ✦ Google Chrome

✦   Defining characteristics:
    ✦ Better performance
    ✦ Advanced JavaScript engines
Firefox 3.1
✦   Set to be released Spring 2009
✦   Goals:
    ✦ Performance improvements
    ✦ Video and Audio tags
    ✦ Private browsing

✦   Beta 1 just released
✦   http://developer.mozilla.org/En/Firefox_3.1_for_developers
Safari 4
✦   Released in conjunction with OS X 10.6
✦   Features:
    ✦ Performance improvements
    ✦ Desktop Apps
    ✦ ACID 3 compliance
    ✦ Revamped dev tools

✦   Preview seeded to developers
✦   http://webkit.org/blog/
Internet Explorer 8
✦   Released late 2008/early 2009
✦   Features:
    ✦ Backwards compatibility with IE 7
    ✦ Web Clips (trim out a part of a page and
      place on desktop)
    ✦ Process per tab

✦   Beta 2 recently
    released
✦   http://www.microsoft.com/
    windows/internet-explorer/
    beta/readiness/new-features.aspx
Opera 10
✦   Unspecified release schedule (2009?)
✦   Features:
    ✦ ACID 3 compliance
    ✦ Video and Audio tags

✦   Opera 9.6 recently released
✦   http://labs.opera.com/
Google Chrome
✦   Released September 2008
✦   Features:
    ✦ Private browsing
    ✦ Process per tab

✦   Next release schedule unknown
✦   http://googlechromereleases.blogspot.com/
Process Per Tab
✦   Most browsers have a single process
    ✦ Share memory, resources
    ✦ Pages rendered using threads

✦   IE 8 and Chrome split tabs into individual
    processes
✦   What does this change?
    ✦ Pages can do more processing
      ✦ (Not block the UI or other tabs)
    ✦ Tabs consume more memory
Process Per Tab
✦   Examples of changes, in Chrome.
✦   Timer speed is what you set it to.
    ✦ Browsers cap the speed to 10ms.
    ✦ setInterval(fn, 1);

✦   Can do more non-stop processing, without
    warning:
    while (true) {}
✦   Chrome has a process manager (like the
    OS process manager - see CPU, Memory)
JavaScript Engines
✦   New wave of engines:
    ✦ Firefox: TraceMonkey
    ✦ Safari: SquirrelFish (Extreme)
    ✦ Chrome: V8

✦   Continually leap-frogging each other
Measuring Speed
✦   SunSpider
    ✦ Released by the WebKit team last fall
    ✦ Focuses completely on JavaScript

✦   Dromaeo
    ✦ Released by Mozilla this spring
    ✦ Mix of JavaScript and DOM

✦   V8 Benchmark
    ✦ Released by Chrome team last month
    ✦ Lots of recursion testing

✦   Quality: http://ejohn.org/blog/javascript-benchmark-quality/
http://ejohn.org/blog/javascript-performance-rundown/
http://ejohn.org/blog/javascript-performance-rundown/
http://ejohn.org/blog/javascript-performance-rundown/
Recent Numbers




http://arstechnica.com/journals/linux.ars/2008/10/07/extreme-javascript-performance
Recent Numbers




http://arstechnica.com/journals/linux.ars/2008/10/07/extreme-javascript-performance
Network
Network
✦   Steve Souders is the man.
✦   http://stevesouders.com/ua/




✦   YSlow
Simultaneous Conn.
✦   Number of downloads per domain
✦   Should be at least 4
    ✦ FF 2, IE 6, and IE 7 are 2
    ✦ Safari is 4
    ✦ Everyone else is 6-7

✦   Max connections: Number of simultaneous
    downloads
    ✦ Firefox, Opera: 25-30
    ✦ Everyone else: 50-60
Parallel Scripts
✦   Download scripts simultaneously
✦   Even though they must execute in order
✦   <script defer>
    ✦ From Internet Explorer
    ✦ Just landed for Firefox 3.1
    ✦ Replacement for JavaScript-based
      loading
Redirect Caching
✦   A simple request:
    http://foo.com ->
    http://www.foo.com ->
    http://www.foo.com/
✦   Very costly, should be cached.
✦   Chrome and Firefox do well here.
Link Prefetching
✦   <link rel=”prefetch” href=”someimg.png”/>
✦   Pre-load resources for later use
    ✦ (images, stylesheets)

✦   Currently only in Firefox
✦   Replacement for JavaScript preloading
DOM Navigation
Class Name
✦   New method:
    getElementsByClassName
✦   Works just like:
    getElementsByTagName
✦   Fast way of finding elements by their class
    name(s):
    <div class=”person sidebar”></div>
✦   document.getElementsByClassName(“sidebar”)
✦   Safari 3.1 and Firefox 3.0
✦   Drop-in replacement for existing queries
Speed Results




http://ejohn.org/blog/getelementsbyclassname-speed-comparison/
Selectors API
✦   querySelectorAll
✦   Use CSS selectors to find DOM elements
✦   document.querySelectorAll(“div p”)
✦   Good cross-browser support
    ✦ IE 8, Safari 4, FF 3, Opera 10

✦   Drop-in replacement for JavaScript
    libraries.
Speed Results




http://www2.webkit.org/perf/slickspeed/
JavaScript Threads
✦   JavaScript has always been single-threaded
✦   Limited to working linearly
✦   New HTML 5 Web Workers
✦   Spawn JavaScript threads
✦   Run complicated work in the background
    ✦ Doesn’t block the browser!

✦   Demo: http://ejohn.org/apps/threads/
✦   Drop-in usable, huge quality boost.
Styling and Effects
✦   Lots of commons styling effects
✦   Can be replaced and simplified by the
    browser
✦   Drastically simplify pages and improve
    their performance
Rounded Corners
✦   CSS 3 specification




✦   Implemented in Safari, Firefox, Opera
    ✦ -moz-border-radius: 5px;
    ✦ -webkit-border-radius: 5px;

✦   Can replace clumsy, slow, old methods.
Shadows
✦   Box Shadows
    ✦ Shadow behind a div
    ✦   -webkit-box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.5)

✦   Text Shadows
    ✦ Shadow behind some text
    ✦   text-shadow: -1px -1px #666, 1px 1px #FFF;
✦   Implemented in WebKit, Firefox
✦   Can replace clumsy, slow, old methods.
Example Shadows




✦   Demos: http://maettig.com/code/css/text-
    shadow.html
    http://webkit.org/blog/86/box-shadow/
Custom Fonts
✦   Load in custom fonts
✦   Can load TrueType fonts
✦   Implemented in Safari and Firefox
✦   Demo: http://ejohn.org/apps/fontface/
    blok.html
✦   Can replace using Flash-based fonts.
Transforms and Animations
✦   Transforms allow you to rotate, scale, and
    offset an element
    ✦ -webkit-transform: rotate(30deg);

✦   Animations allow you to morph an
    element using nothing but CSS
    ✦ -webkit-transition: all 1s ease-in-out;

✦   Implemented in WebKit and Firefox
✦   Demo: http://www.the-art-of-web.com/css/
    css-animation/
✦   Can replace JS animations, today.
Canvas
✦   Proposed and first implemented by Apple
    in WebKit
✦   A 2d drawing layer
    ✦ With possibilities for future expansion

✦   Embedded in web pages (looks and
    behaves like an img element)
✦   Works in all browsers (IE with ExCanvas)
✦   Offload rendering to client
✦   Better user interaction
Shapes and Paths
✦   NOT vectors (unlike SVG)
✦   Rectangles
✦   Arcs
✦   Lines
✦   Curves


✦   Charts:
Fill and Stroke
✦   All can be styled (similar to CSS)
✦   Stroke styles the path (or outline)
✦   Fill is the color of the interior
✦   Sparklines:
Canvas Embedding
✦   Canvases can consume:
    ✦ Images
    ✦ Other Canvases

✦   Will be able to consume (Firefox 3.1):
    ✦ Video

✦   In an extension:
    ✦ Web Pages
Data
Native JSON
✦   JSON is a format for transferring data
✦   (Uses JavaScript syntax to achieve this.)
✦   Has been slow and a little hacky.
✦   Browser now have native support in
    Firefox 3.1 and IE 8
✦   Drop-in usable, today
    ✦ JSON.encode(object)
    ✦ JSON.decode(string)
Performance
✦   Encoding:




✦   Decoding:
New Measurements
Painting
✦   When something is physically drawn to
    the screen
✦   Hard to quantify without more
    information
✦   Firefox 3.1 includes a new event:
    MozAfterPaint
✦   Demo: http://ejohn.org/blog/browser-
    paint-events/
Reflow
✦   CSS has lots of boxes in it
✦   Position of boxes is constantly recomputed
    and repositioned (before being painted)
    ✦ This is reflow

✦   Demo: http://dougt.wordpress.com/
    2008/05/24/what-is-a-reflow/
Questions?
✦   John Resig
    http://ejohn.org/
    http://twitter.com/jeresig/

More Related Content

What's hot

WordPress Development Tools and Best Practices
WordPress Development Tools and Best PracticesWordPress Development Tools and Best Practices
WordPress Development Tools and Best Practices
Danilo Ercoli
 
Hands on performance testing and analysis with web pagetest
Hands on performance testing and analysis with web pagetestHands on performance testing and analysis with web pagetest
Hands on performance testing and analysis with web pagetest
Patrick Meenan
 
Ajax Tutorial
Ajax TutorialAjax Tutorial
Ajax Tutorial
oscon2007
 

What's hot (20)

WordPress Development Tools and Best Practices
WordPress Development Tools and Best PracticesWordPress Development Tools and Best Practices
WordPress Development Tools and Best Practices
 
WebPagetest - Good, Bad & Ugly
WebPagetest - Good, Bad & UglyWebPagetest - Good, Bad & Ugly
WebPagetest - Good, Bad & Ugly
 
Improve WordPress performance with caching and deferred execution of code
Improve WordPress performance with caching and deferred execution of codeImprove WordPress performance with caching and deferred execution of code
Improve WordPress performance with caching and deferred execution of code
 
Mobile Hybrid Development with WordPress
Mobile Hybrid Development with WordPressMobile Hybrid Development with WordPress
Mobile Hybrid Development with WordPress
 
WebPagetest Power Users - Velocity 2014
WebPagetest Power Users - Velocity 2014WebPagetest Power Users - Velocity 2014
WebPagetest Power Users - Velocity 2014
 
Introduction to WebSockets
Introduction to WebSocketsIntroduction to WebSockets
Introduction to WebSockets
 
Node JS Express : Steps to Create Restful Web App
Node JS Express : Steps to Create Restful Web AppNode JS Express : Steps to Create Restful Web App
Node JS Express : Steps to Create Restful Web App
 
Hands on performance testing and analysis with web pagetest
Hands on performance testing and analysis with web pagetestHands on performance testing and analysis with web pagetest
Hands on performance testing and analysis with web pagetest
 
EasyEngine - Command-Line tool to manage WordPress Sites on Nginx
EasyEngine - Command-Line tool to manage WordPress Sites on NginxEasyEngine - Command-Line tool to manage WordPress Sites on Nginx
EasyEngine - Command-Line tool to manage WordPress Sites on Nginx
 
Velocity 2014 nyc WebPagetest private instances
Velocity 2014 nyc   WebPagetest private instancesVelocity 2014 nyc   WebPagetest private instances
Velocity 2014 nyc WebPagetest private instances
 
Measuring web performance
Measuring web performanceMeasuring web performance
Measuring web performance
 
Front End Performance
Front End PerformanceFront End Performance
Front End Performance
 
Front end performance optimization
Front end performance optimizationFront end performance optimization
Front end performance optimization
 
soft-shake.ch - Introduction to HTML5
soft-shake.ch - Introduction to HTML5soft-shake.ch - Introduction to HTML5
soft-shake.ch - Introduction to HTML5
 
Ajax Tutorial
Ajax TutorialAjax Tutorial
Ajax Tutorial
 
Front end performance tip
Front end performance tipFront end performance tip
Front end performance tip
 
Lessons Learned with Unity and WebGL
Lessons Learned with Unity and WebGLLessons Learned with Unity and WebGL
Lessons Learned with Unity and WebGL
 
How to Build Real-time Chat App with Express, ReactJS, and Socket.IO?
How to Build Real-time Chat App with Express, ReactJS, and Socket.IO?How to Build Real-time Chat App with Express, ReactJS, and Socket.IO?
How to Build Real-time Chat App with Express, ReactJS, and Socket.IO?
 
Create ReactJS Component & publish as npm package
Create ReactJS Component & publish as npm packageCreate ReactJS Component & publish as npm package
Create ReactJS Component & publish as npm package
 
Here Be Dragons - Debugging WordPress
Here Be Dragons - Debugging WordPressHere Be Dragons - Debugging WordPress
Here Be Dragons - Debugging WordPress
 

Viewers also liked

Introduction to jQuery (Ajax Exp 2006)
Introduction to jQuery (Ajax Exp 2006)Introduction to jQuery (Ajax Exp 2006)
Introduction to jQuery (Ajax Exp 2006)
jeresig
 
Marketing Plan Scheme
Marketing Plan SchemeMarketing Plan Scheme
Marketing Plan Scheme
lindayam
 
3dMobileyes Media Presentation
3dMobileyes Media Presentation3dMobileyes Media Presentation
3dMobileyes Media Presentation
3rddimension
 
JavaScript is Real Code
JavaScript is Real CodeJavaScript is Real Code
JavaScript is Real Code
Len Smith
 
jQuery Open Source Process (RIT 2011)
jQuery Open Source Process (RIT 2011)jQuery Open Source Process (RIT 2011)
jQuery Open Source Process (RIT 2011)
jeresig
 
Cottage Cell Phone In China
Cottage Cell Phone In ChinaCottage Cell Phone In China
Cottage Cell Phone In China
Yuancheng Yang
 

Viewers also liked (20)

Testing Mobile JavaScript (Fall 2010
Testing Mobile JavaScript (Fall 2010Testing Mobile JavaScript (Fall 2010
Testing Mobile JavaScript (Fall 2010
 
Khan Academy Computer Science
Khan Academy Computer ScienceKhan Academy Computer Science
Khan Academy Computer Science
 
Introduction to jQuery (Ajax Exp 2006)
Introduction to jQuery (Ajax Exp 2006)Introduction to jQuery (Ajax Exp 2006)
Introduction to jQuery (Ajax Exp 2006)
 
jQuery Open Source (Fronteer 2011)
jQuery Open Source (Fronteer 2011)jQuery Open Source (Fronteer 2011)
jQuery Open Source (Fronteer 2011)
 
jQuery Keynote - Fall 2010
jQuery Keynote - Fall 2010jQuery Keynote - Fall 2010
jQuery Keynote - Fall 2010
 
Applying Computer Vision to Art History
Applying Computer Vision to Art HistoryApplying Computer Vision to Art History
Applying Computer Vision to Art History
 
Teatro de Viena
Teatro de VienaTeatro de Viena
Teatro de Viena
 
Bringing International Learning to Life with Films Handout
Bringing International Learning to Life with Films HandoutBringing International Learning to Life with Films Handout
Bringing International Learning to Life with Films Handout
 
Marketing Plan Scheme
Marketing Plan SchemeMarketing Plan Scheme
Marketing Plan Scheme
 
Epic research daily agri report 10th march 2016
Epic research daily agri report 10th march 2016Epic research daily agri report 10th march 2016
Epic research daily agri report 10th march 2016
 
3dMobileyes Media Presentation
3dMobileyes Media Presentation3dMobileyes Media Presentation
3dMobileyes Media Presentation
 
JavaScript is Real Code
JavaScript is Real CodeJavaScript is Real Code
JavaScript is Real Code
 
Jill 11
Jill 11Jill 11
Jill 11
 
Was ein Tantra Kurs beinhalten sollte
Was ein Tantra Kurs beinhalten sollte Was ein Tantra Kurs beinhalten sollte
Was ein Tantra Kurs beinhalten sollte
 
The Future of JavaScript (Ajax Exp '07)
The Future of JavaScript (Ajax Exp '07)The Future of JavaScript (Ajax Exp '07)
The Future of JavaScript (Ajax Exp '07)
 
De Kempen
De KempenDe Kempen
De Kempen
 
De Donau Zo Blauw
De Donau Zo BlauwDe Donau Zo Blauw
De Donau Zo Blauw
 
Autumn scene
Autumn sceneAutumn scene
Autumn scene
 
jQuery Open Source Process (RIT 2011)
jQuery Open Source Process (RIT 2011)jQuery Open Source Process (RIT 2011)
jQuery Open Source Process (RIT 2011)
 
Cottage Cell Phone In China
Cottage Cell Phone In ChinaCottage Cell Phone In China
Cottage Cell Phone In China
 

Similar to Performance Improvements in Browsers

Performance Improvements In Browsers
Performance Improvements In BrowsersPerformance Improvements In Browsers
Performance Improvements In Browsers
GoogleTecTalks
 
MozTW YZU CSE Lecture
MozTW YZU CSE LectureMozTW YZU CSE Lecture
MozTW YZU CSE Lecture
littlebtc
 
Drupal Camp Sthml 09
Drupal Camp Sthml 09Drupal Camp Sthml 09
Drupal Camp Sthml 09
Pelle Wessman
 
State of jQuery - AspDotNetStorefront Conference
State of jQuery - AspDotNetStorefront ConferenceState of jQuery - AspDotNetStorefront Conference
State of jQuery - AspDotNetStorefront Conference
dmethvin
 

Similar to Performance Improvements in Browsers (20)

Performance Improvements In Browsers
Performance Improvements In BrowsersPerformance Improvements In Browsers
Performance Improvements In Browsers
 
The Future of Firefox and JavaScript
The Future of Firefox and JavaScriptThe Future of Firefox and JavaScript
The Future of Firefox and JavaScript
 
Learning jQuery @ MIT
Learning jQuery @ MITLearning jQuery @ MIT
Learning jQuery @ MIT
 
XTech May 2008
XTech May 2008XTech May 2008
XTech May 2008
 
Building a JavaScript Library
Building a JavaScript LibraryBuilding a JavaScript Library
Building a JavaScript Library
 
MozTW YZU CSE Lecture
MozTW YZU CSE LectureMozTW YZU CSE Lecture
MozTW YZU CSE Lecture
 
Chris Wilson @ FOWA Feb 07
Chris Wilson @ FOWA Feb 07Chris Wilson @ FOWA Feb 07
Chris Wilson @ FOWA Feb 07
 
jQuery 1.3 and jQuery UI
jQuery 1.3 and jQuery UIjQuery 1.3 and jQuery UI
jQuery 1.3 and jQuery UI
 
Nuxeo Roadmap 2008/06
Nuxeo Roadmap 2008/06Nuxeo Roadmap 2008/06
Nuxeo Roadmap 2008/06
 
Once upon a time, there were css, js and server-side rendering
Once upon a time, there were css, js and server-side renderingOnce upon a time, there were css, js and server-side rendering
Once upon a time, there were css, js and server-side rendering
 
Web Development: The Next Five Years
Web Development: The Next Five YearsWeb Development: The Next Five Years
Web Development: The Next Five Years
 
Drupal Camp Sthml 09
Drupal Camp Sthml 09Drupal Camp Sthml 09
Drupal Camp Sthml 09
 
Html5 Game Development with Canvas
Html5 Game Development with CanvasHtml5 Game Development with Canvas
Html5 Game Development with Canvas
 
JS digest. October 2017
JS digest. October 2017 JS digest. October 2017
JS digest. October 2017
 
Performance, Games, and Distributed Testing in JavaScript
Performance, Games, and Distributed Testing in JavaScriptPerformance, Games, and Distributed Testing in JavaScript
Performance, Games, and Distributed Testing in JavaScript
 
Web Performance Part 3 "Server-side tips"
Web Performance Part 3  "Server-side tips"Web Performance Part 3  "Server-side tips"
Web Performance Part 3 "Server-side tips"
 
Conquering Gef Part2: Building graphical web-apps with Eclipse
Conquering Gef Part2: Building graphical web-apps with EclipseConquering Gef Part2: Building graphical web-apps with Eclipse
Conquering Gef Part2: Building graphical web-apps with Eclipse
 
New Features Coming in Browsers (RIT '09)
New Features Coming in Browsers (RIT '09)New Features Coming in Browsers (RIT '09)
New Features Coming in Browsers (RIT '09)
 
State of jQuery - AspDotNetStorefront Conference
State of jQuery - AspDotNetStorefront ConferenceState of jQuery - AspDotNetStorefront Conference
State of jQuery - AspDotNetStorefront Conference
 
Untying the Knots of Web Dev with Internet Explorer
Untying the Knots of Web Dev with Internet Explorer Untying the Knots of Web Dev with Internet Explorer
Untying the Knots of Web Dev with Internet Explorer
 

More from jeresig

JavaScript Libraries (Ajax Exp 2006)
JavaScript Libraries (Ajax Exp 2006)JavaScript Libraries (Ajax Exp 2006)
JavaScript Libraries (Ajax Exp 2006)
jeresig
 
jQuery Recommendations to the W3C (2011)
jQuery Recommendations to the W3C (2011)jQuery Recommendations to the W3C (2011)
jQuery Recommendations to the W3C (2011)
jeresig
 
jQuery Open Source Process (Knight Foundation 2011)
jQuery Open Source Process (Knight Foundation 2011)jQuery Open Source Process (Knight Foundation 2011)
jQuery Open Source Process (Knight Foundation 2011)
jeresig
 

More from jeresig (20)

Does Coding Every Day Matter?
Does Coding Every Day Matter?Does Coding Every Day Matter?
Does Coding Every Day Matter?
 
Accidentally Becoming a Digital Librarian
Accidentally Becoming a Digital LibrarianAccidentally Becoming a Digital Librarian
Accidentally Becoming a Digital Librarian
 
2014: John's Favorite Thing (Neo4j)
2014: John's Favorite Thing (Neo4j)2014: John's Favorite Thing (Neo4j)
2014: John's Favorite Thing (Neo4j)
 
Computer Vision as Art Historical Investigation
Computer Vision as Art Historical InvestigationComputer Vision as Art Historical Investigation
Computer Vision as Art Historical Investigation
 
Hacking Art History
Hacking Art HistoryHacking Art History
Hacking Art History
 
Using JS to teach JS at Khan Academy
Using JS to teach JS at Khan AcademyUsing JS to teach JS at Khan Academy
Using JS to teach JS at Khan Academy
 
Applying Computer Vision to Art History
Applying Computer Vision to Art HistoryApplying Computer Vision to Art History
Applying Computer Vision to Art History
 
NYARC 2014: Frick/Zeri Results
NYARC 2014: Frick/Zeri ResultsNYARC 2014: Frick/Zeri Results
NYARC 2014: Frick/Zeri Results
 
EmpireJS: Hacking Art with Node js and Image Analysis
EmpireJS: Hacking Art with Node js and Image AnalysisEmpireJS: Hacking Art with Node js and Image Analysis
EmpireJS: Hacking Art with Node js and Image Analysis
 
JavaScript Libraries (Ajax Exp 2006)
JavaScript Libraries (Ajax Exp 2006)JavaScript Libraries (Ajax Exp 2006)
JavaScript Libraries (Ajax Exp 2006)
 
jQuery Recommendations to the W3C (2011)
jQuery Recommendations to the W3C (2011)jQuery Recommendations to the W3C (2011)
jQuery Recommendations to the W3C (2011)
 
jQuery Open Source Process (Knight Foundation 2011)
jQuery Open Source Process (Knight Foundation 2011)jQuery Open Source Process (Knight Foundation 2011)
jQuery Open Source Process (Knight Foundation 2011)
 
jQuery Mobile
jQuery MobilejQuery Mobile
jQuery Mobile
 
Holistic JavaScript Performance
Holistic JavaScript PerformanceHolistic JavaScript Performance
Holistic JavaScript Performance
 
Introduction to jQuery (Ajax Exp 2007)
Introduction to jQuery (Ajax Exp 2007)Introduction to jQuery (Ajax Exp 2007)
Introduction to jQuery (Ajax Exp 2007)
 
Advanced jQuery (Ajax Exp 2007)
Advanced jQuery (Ajax Exp 2007)Advanced jQuery (Ajax Exp 2007)
Advanced jQuery (Ajax Exp 2007)
 
JavaScript Library Overview (Ajax Exp West 2007)
JavaScript Library Overview (Ajax Exp West 2007)JavaScript Library Overview (Ajax Exp West 2007)
JavaScript Library Overview (Ajax Exp West 2007)
 
Meta Programming with JavaScript
Meta Programming with JavaScriptMeta Programming with JavaScript
Meta Programming with JavaScript
 
Advancing JavaScript with Libraries (Yahoo Tech Talk)
Advancing JavaScript with Libraries (Yahoo Tech Talk)Advancing JavaScript with Libraries (Yahoo Tech Talk)
Advancing JavaScript with Libraries (Yahoo Tech Talk)
 
State of jQuery and Drupal
State of jQuery and DrupalState of jQuery and Drupal
State of jQuery and Drupal
 

Recently uploaded

Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 
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
Safe 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 2024
Victor Rentea
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 

Recently uploaded (20)

Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
JohnPollard-hybrid-app-RailsConf2024.pptx
JohnPollard-hybrid-app-RailsConf2024.pptxJohnPollard-hybrid-app-RailsConf2024.pptx
JohnPollard-hybrid-app-RailsConf2024.pptx
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Platformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityPlatformless Horizons for Digital Adaptability
Platformless Horizons for Digital Adaptability
 
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
 
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
 
Introduction to use of FHIR Documents in ABDM
Introduction to use of FHIR Documents in ABDMIntroduction to use of FHIR Documents in ABDM
Introduction to use of FHIR Documents in ABDM
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
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
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
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
 
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...
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
 
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
 
AI in Action: Real World Use Cases by Anitaraj
AI in Action: Real World Use Cases by AnitarajAI in Action: Real World Use Cases by Anitaraj
AI in Action: Real World Use Cases by Anitaraj
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistan
 

Performance Improvements in Browsers

  • 1. Performance Improvements in Browsers John Resig http://ejohn.org/ - http://twitter.com/jeresig/
  • 2. About Me ✦ Work for the Mozilla Corporation (Firefox!) ✦ Do a lot of JavaScript performance analysis ✦ Dromaeo.com is my performance test suite ✦ Tests the performance of JavaScript engines ✦ Tests the performance of browser DOM ✦ Work on Firebug (great developer tool) ✦ Creator of the jQuery JavaScript Library ✦ http://jquery.com/ ✦ Used by Microsoft, Google, Adobe, Nokia, IBM, Intel, CBS News, NBC, etc.
  • 3. Upcoming Browsers ✦ The browsers: ✦ Firefox 3.1 ✦ Safari 4 ✦ Internet Explorer 8 ✦ Opera 10 ✦ Google Chrome ✦ Defining characteristics: ✦ Better performance ✦ Advanced JavaScript engines
  • 4. Firefox 3.1 ✦ Set to be released Spring 2009 ✦ Goals: ✦ Performance improvements ✦ Video and Audio tags ✦ Private browsing ✦ Beta 1 just released ✦ http://developer.mozilla.org/En/Firefox_3.1_for_developers
  • 5. Safari 4 ✦ Released in conjunction with OS X 10.6 ✦ Features: ✦ Performance improvements ✦ Desktop Apps ✦ ACID 3 compliance ✦ Revamped dev tools ✦ Preview seeded to developers ✦ http://webkit.org/blog/
  • 6. Internet Explorer 8 ✦ Released late 2008/early 2009 ✦ Features: ✦ Backwards compatibility with IE 7 ✦ Web Clips (trim out a part of a page and place on desktop) ✦ Process per tab ✦ Beta 2 recently released ✦ http://www.microsoft.com/ windows/internet-explorer/ beta/readiness/new-features.aspx
  • 7. Opera 10 ✦ Unspecified release schedule (2009?) ✦ Features: ✦ ACID 3 compliance ✦ Video and Audio tags ✦ Opera 9.6 recently released ✦ http://labs.opera.com/
  • 8. Google Chrome ✦ Released September 2008 ✦ Features: ✦ Private browsing ✦ Process per tab ✦ Next release schedule unknown ✦ http://googlechromereleases.blogspot.com/
  • 9. Process Per Tab ✦ Most browsers have a single process ✦ Share memory, resources ✦ Pages rendered using threads ✦ IE 8 and Chrome split tabs into individual processes ✦ What does this change? ✦ Pages can do more processing ✦ (Not block the UI or other tabs) ✦ Tabs consume more memory
  • 10. Process Per Tab ✦ Examples of changes, in Chrome. ✦ Timer speed is what you set it to. ✦ Browsers cap the speed to 10ms. ✦ setInterval(fn, 1); ✦ Can do more non-stop processing, without warning: while (true) {} ✦ Chrome has a process manager (like the OS process manager - see CPU, Memory)
  • 11. JavaScript Engines ✦ New wave of engines: ✦ Firefox: TraceMonkey ✦ Safari: SquirrelFish (Extreme) ✦ Chrome: V8 ✦ Continually leap-frogging each other
  • 12. Measuring Speed ✦ SunSpider ✦ Released by the WebKit team last fall ✦ Focuses completely on JavaScript ✦ Dromaeo ✦ Released by Mozilla this spring ✦ Mix of JavaScript and DOM ✦ V8 Benchmark ✦ Released by Chrome team last month ✦ Lots of recursion testing ✦ Quality: http://ejohn.org/blog/javascript-benchmark-quality/
  • 19. Network ✦ Steve Souders is the man. ✦ http://stevesouders.com/ua/ ✦ YSlow
  • 20. Simultaneous Conn. ✦ Number of downloads per domain ✦ Should be at least 4 ✦ FF 2, IE 6, and IE 7 are 2 ✦ Safari is 4 ✦ Everyone else is 6-7 ✦ Max connections: Number of simultaneous downloads ✦ Firefox, Opera: 25-30 ✦ Everyone else: 50-60
  • 21. Parallel Scripts ✦ Download scripts simultaneously ✦ Even though they must execute in order ✦ <script defer> ✦ From Internet Explorer ✦ Just landed for Firefox 3.1 ✦ Replacement for JavaScript-based loading
  • 22. Redirect Caching ✦ A simple request: http://foo.com -> http://www.foo.com -> http://www.foo.com/ ✦ Very costly, should be cached. ✦ Chrome and Firefox do well here.
  • 23. Link Prefetching ✦ <link rel=”prefetch” href=”someimg.png”/> ✦ Pre-load resources for later use ✦ (images, stylesheets) ✦ Currently only in Firefox ✦ Replacement for JavaScript preloading
  • 25. Class Name ✦ New method: getElementsByClassName ✦ Works just like: getElementsByTagName ✦ Fast way of finding elements by their class name(s): <div class=”person sidebar”></div> ✦ document.getElementsByClassName(“sidebar”) ✦ Safari 3.1 and Firefox 3.0 ✦ Drop-in replacement for existing queries
  • 27. Selectors API ✦ querySelectorAll ✦ Use CSS selectors to find DOM elements ✦ document.querySelectorAll(“div p”) ✦ Good cross-browser support ✦ IE 8, Safari 4, FF 3, Opera 10 ✦ Drop-in replacement for JavaScript libraries.
  • 29. JavaScript Threads ✦ JavaScript has always been single-threaded ✦ Limited to working linearly ✦ New HTML 5 Web Workers ✦ Spawn JavaScript threads ✦ Run complicated work in the background ✦ Doesn’t block the browser! ✦ Demo: http://ejohn.org/apps/threads/ ✦ Drop-in usable, huge quality boost.
  • 30. Styling and Effects ✦ Lots of commons styling effects ✦ Can be replaced and simplified by the browser ✦ Drastically simplify pages and improve their performance
  • 31. Rounded Corners ✦ CSS 3 specification ✦ Implemented in Safari, Firefox, Opera ✦ -moz-border-radius: 5px; ✦ -webkit-border-radius: 5px; ✦ Can replace clumsy, slow, old methods.
  • 32. Shadows ✦ Box Shadows ✦ Shadow behind a div ✦ -webkit-box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.5) ✦ Text Shadows ✦ Shadow behind some text ✦ text-shadow: -1px -1px #666, 1px 1px #FFF; ✦ Implemented in WebKit, Firefox ✦ Can replace clumsy, slow, old methods.
  • 33. Example Shadows ✦ Demos: http://maettig.com/code/css/text- shadow.html http://webkit.org/blog/86/box-shadow/
  • 34. Custom Fonts ✦ Load in custom fonts ✦ Can load TrueType fonts ✦ Implemented in Safari and Firefox ✦ Demo: http://ejohn.org/apps/fontface/ blok.html ✦ Can replace using Flash-based fonts.
  • 35. Transforms and Animations ✦ Transforms allow you to rotate, scale, and offset an element ✦ -webkit-transform: rotate(30deg); ✦ Animations allow you to morph an element using nothing but CSS ✦ -webkit-transition: all 1s ease-in-out; ✦ Implemented in WebKit and Firefox ✦ Demo: http://www.the-art-of-web.com/css/ css-animation/ ✦ Can replace JS animations, today.
  • 36. Canvas ✦ Proposed and first implemented by Apple in WebKit ✦ A 2d drawing layer ✦ With possibilities for future expansion ✦ Embedded in web pages (looks and behaves like an img element) ✦ Works in all browsers (IE with ExCanvas) ✦ Offload rendering to client ✦ Better user interaction
  • 37. Shapes and Paths ✦ NOT vectors (unlike SVG) ✦ Rectangles ✦ Arcs ✦ Lines ✦ Curves ✦ Charts:
  • 38. Fill and Stroke ✦ All can be styled (similar to CSS) ✦ Stroke styles the path (or outline) ✦ Fill is the color of the interior ✦ Sparklines:
  • 39. Canvas Embedding ✦ Canvases can consume: ✦ Images ✦ Other Canvases ✦ Will be able to consume (Firefox 3.1): ✦ Video ✦ In an extension: ✦ Web Pages
  • 40. Data
  • 41. Native JSON ✦ JSON is a format for transferring data ✦ (Uses JavaScript syntax to achieve this.) ✦ Has been slow and a little hacky. ✦ Browser now have native support in Firefox 3.1 and IE 8 ✦ Drop-in usable, today ✦ JSON.encode(object) ✦ JSON.decode(string)
  • 42. Performance ✦ Encoding: ✦ Decoding:
  • 44. Painting ✦ When something is physically drawn to the screen ✦ Hard to quantify without more information ✦ Firefox 3.1 includes a new event: MozAfterPaint ✦ Demo: http://ejohn.org/blog/browser- paint-events/
  • 45. Reflow ✦ CSS has lots of boxes in it ✦ Position of boxes is constantly recomputed and repositioned (before being painted) ✦ This is reflow ✦ Demo: http://dougt.wordpress.com/ 2008/05/24/what-is-a-reflow/
  • 46. Questions? ✦ John Resig http://ejohn.org/ http://twitter.com/jeresig/