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

āœ¦   Deļ¬ning 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
āœ¦   Unspeciļ¬ed 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 ļ¬nding 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 ļ¬nd 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 Eļ¬€ects
āœ¦   Lots of commons styling eļ¬€ects
āœ¦   Can be replaced and simpliļ¬ed by the
    browser
āœ¦   Drastically simplify pages and improve
    their performance
Rounded Corners
āœ¦   CSS 3 speciļ¬cation




āœ¦   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
    oļ¬€set 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 ļ¬rst 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)
āœ¦   Oļ¬„oad 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/
Reļ¬‚ow
āœ¦   CSS has lots of boxes in it
āœ¦   Position of boxes is constantly recomputed
    and repositioned (before being painted)
    āœ¦ This is reļ¬‚ow

āœ¦   Demo: http://dougt.wordpress.com/
    2008/05/24/what-is-a-reļ¬‚ow/
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
Ā 
Jill 11
Jill 11Jill 11
Jill 11
kfehr2010
Ā 
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

Applying Computer Vision to Art History
Applying Computer Vision to Art HistoryApplying Computer Vision to Art History
Applying Computer Vision to Art History
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

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
Ā 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
WSO2
Ā 
+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)

ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
Ā 
Navi Mumbai Call Girls šŸ„° 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls šŸ„° 8617370543 Service Offer VIP Hot ModelNavi Mumbai Call Girls šŸ„° 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls šŸ„° 8617370543 Service Offer VIP Hot Model
Ā 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
Ā 
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...
Ā 
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
Ā 
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
Ā 
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, ...
Ā 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
Ā 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
Ā 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Ā 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Ā 
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
Ā 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Ā 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
Ā 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
Ā 
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...
Ā 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
Ā 
+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...
Ā 
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
Ā 

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 āœ¦ Deļ¬ning 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 āœ¦ Unspeciļ¬ed 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 ļ¬nding 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 ļ¬nd 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 Eļ¬€ects āœ¦ Lots of commons styling eļ¬€ects āœ¦ Can be replaced and simpliļ¬ed by the browser āœ¦ Drastically simplify pages and improve their performance
  • 31. Rounded Corners āœ¦ CSS 3 speciļ¬cation āœ¦ 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 oļ¬€set 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 ļ¬rst 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) āœ¦ Oļ¬„oad 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. Reļ¬‚ow āœ¦ CSS has lots of boxes in it āœ¦ Position of boxes is constantly recomputed and repositioned (before being painted) āœ¦ This is reļ¬‚ow āœ¦ Demo: http://dougt.wordpress.com/ 2008/05/24/what-is-a-reļ¬‚ow/
  • 46. Questions? āœ¦ John Resig http://ejohn.org/ http://twitter.com/jeresig/