SlideShare ist ein Scribd-Unternehmen logo
1 von 29
Performance Best Practices - Part 1 -
Client Side [JS, CSS, HTML, jQuery]
Presenter: Sathyan, Mindfire Solutions
Date: 03rd Sep 2013
Image Source: http://www.webperformancetoday.com/2011/06/30/revisiting-the-
performance-equation/ Presenter: Sathyan, Mindfire Solutions
Presenter: Sathyan, Mindfire Solutions
 Average Frontend time is 75% and above
 No inline JavaScript
 No Inline Styles
 Refer only the necessary include [js, css, etc.]
files for the page
 Always remove code, DOM, CSS that you do
not need – Sample
 Minimal comments, comment only what the
code does and not how!
 Use JSON
 Less less less
Presenter: Sathyan, Mindfire Solutions
 Minimize HTTP Requests
 Put Stylesheets at the Top
 Put Scripts at the Bottom
 Avoid Redirects
 Make Ajax Cacheable
 Use GET for AJAX Requests
 Post-load Components
 Preload Components
 Reduce the Number of DOM Elements
Presenter: Sathyan, Mindfire Solutions
 JAX
 What?
 Really?
 AJAX Control Toolkit
 But I need It…
 Callback
 Read
 See
Presenter: Sathyan, Mindfire Solutions
Presenter: Sathyan, Mindfire Solutions
 CSS Sprites
 http://www.websiteoptimization.com/speed/
tweak/css-sprites/
 Replace graphic rollovers with CSS rollovers
 colored backgrounds, borders, or spacing
instead of graphic techniques
 Replace graphic text headers with CSS text
headers
Presenter: Sathyan, Mindfire Solutions
 Use efficient CSS selectors
◦ Right to left $(“body #container div a”)
◦ Rules with descendants body * {...}.hide-scrollbars * {...}
◦ Rules with child or adjacent selectors body > * {...}.hide-
scrollbars * {...}
◦ Rules with overly qualified selectors – IDs with tags
◦ Remove redundant qualifiers.
 Avoid CSS expressions [ IE 5 – 7]
 Put CSS in the document head
 Specify image dimensions
 Specify a character set
Presenter: Sathyan, Mindfire Solutions
 CSS 3 ?
 Group Similar Styles
 Reduce No of line breaks
 Simple colors #333333, #DDDDDD, #112255, #AABBCC, #FF0000
to #333, #DDD, #125, #ABC, #F00
 Remove “px”
 Images
Presenter: Sathyan, Mindfire Solutions
 Scroll, Resize 
 Chrome Developer Tools – Profiles – flipkart
 CSS Stress Test
 Chrome Developer Tools – Timeline Ctrl E R
flipkart
 Chrome Developer Tools –Audit
Presenter: Sathyan, Mindfire Solutions
 Native JS Code
 Grouping
 Reuse
 Caching
 Refer an element as directly as possible using
the ID selector rather than using search/find
in a container, yes that is right, because it
translates directly to good old
getElementByID()
 Concat with Array.prototype.join() – Really?
 Data Structures Push() pop() Shift() - Read
 Use ‘this’
 Switch it!
 Loops $.each() Vs Native
 Initializing instance variables
 Know your Closures
 Cache – $(".someelement") -- Assign to a Var!
Presenter: Sathyan, Mindfire Solutions
Presenter: Sathyan, Mindfire Solutions
 Always Unbind before binding
 Most abused part
 Leads to repeated calls
 Repeated requests leads to pathetic web page
 See
 DOM Manipulation is BAD
for (var ct=0; ct <1000; ++ct)
{
$("#header").html($("#header").html() + ‘something from resultset’);
}
should be written as:
var fullHeaderContent = $("#header").html();
for (var ct=0; ct <1000; ++ct)
{
fullHeaderContent += ‘something from resultset’;
}
$("#header").html(fullHeaderContent );
Presenter: Sathyan, Mindfire Solutions
//BAD
for (var ctPatient=0; ctPatient<=rows.length; ++ctPatient)
{
$('#alertResult').append('<tr><td>'+rows[ctPatient]+'</td></tr>');
}
// AWESOME
var domTree = '';
for (var ctPatient=0; ctPatient<=rows.length; ++ctPatient)
{
domTree += '<tr><td>'+rows[ctPatient]+'</td></tr>';
}
$('#alertResult').append(domTree);
Presenter: Sathyan, Mindfire Solutions
Presenter: Sathyan, Mindfire Solutions
 Avoid using pseudo and attribute selectors
◦ $(‘:visible, :hidden’); $(’[attribute=value]’);
 Class Selectors Next Slower [IE9]
 Tags!
 ID ID ID ID
 Chaining – Multi Selectors
 Sizzle
 Depth of call stack
 Rapid fire rounds – 2 to 3 milliseconds
 Even bubbling – Super Post
 Mouseup Vs Click
Presenter: Sathyan, Mindfire Solutions
$("#longlist li").on("mouseenter", function() { $(this).text("Click
me!");
});
$("#longlist li").on("click", function() { $(this).text("Why did you click
me?!");
});
var list = $("#longlist");
list.on("mouseenter", "li", function(){
$(this).text("Click me!");
});
list.on("click", "li", function() {
$(this).text("Why did you click me?!");
});
http://gregfranko.com/jquery-best-practices/#/20
 Hello World!
 Why?
 Options?
 Window Events?
Presenter: Sathyan, Mindfire Solutions
 It matters
 The latest is the greatest, always
Presenter: Sathyan, Mindfire Solutions
 The best Javascript debugger out there!
 Console shows warning, errors, info
 Look for Yellow and Red – If you see them,
they are bad, get rid of those warnings, errors
right away!
 Do you see 404? Bad, Very Bad, Please act on
it
 Are there repeated calls? No use of “stressing”
the point here, get rid of duplicate calls.
 Net Tab – Wait time - receive time
Presenter: Sathyan, Mindfire Solutions
 Asynch Calls for Wait time
 Number of requests – can they be reduced?
Are there repeated calls? Where is the most
time spent?
 Categorize the bottlenecks using the waterfall
charts
 console.profile, console.time and other
Console APIs are very powerful, learn and use
http://getfirebug.com/wiki/index.php/Conso
le_API
Presenter: Sathyan, Mindfire Solutions
 Yslow
◦ Use a Content Delivery Network (CDN)
◦ Add Expires headers
◦ Avoid empty src or href
◦ Compress components with gzip
◦ Configure entity tags (ETags)
◦ Make favicon small and cacheable
◦ Minification
◦ Bundling
◦ One Big JS/CSS
Presenter: Sathyan, Mindfire Solutions
 uniform way to analyze and report on the
degree to which measured performance
meets user expectations.
 Set Your Apdex Score
 Et Your Apdex Score
Presenter: Sathyan, Mindfire Solutions
 Chrome Developer Tools – Audit
 Miniprofiler
 Glimpse
 Firebug - Network
 Yslow
 PageSpeed
 Newrelic
 http://www.webpagetest.org/
 https://code.google.com/p/leak-finder-for-
javascript/
Presenter: Sathyan, Mindfire Solutions
Presenter: Sathyan, Mindfire Solutions
Presenter: Sathyan, Mindfire Solutions
 http://www.stevesouders.com
 http://www.websiteoptimization.com/
 http://www.webpagetest.org/
 http://webdevchecklist.com/asp.net/performance/
 http://www.strangeloopnetworks.com/assets/images/visualizing_web_performance_pos
ter.jpg
 https://developers.google.com/speed/pagespeed/?csw=1
 https://developers.google.com/speed/docs/best-practices/rendering
 http://oreilly.com/server-administration/excerpts/even-faster-websites/writing-
efficient-javascript.html
 http://gregfranko.com/jquery-best-practices/#/
 http://www.artzstudio.com/2009/04/jquery-performance-rules/
 http://vimeo.com/43659068
 http://addyosmani.com/blog/
 http://www.webperformancetoday.com/2010/07/09/waterfalls-101/
Presenter: Sathyan, Mindfire Solutions
Question and Answer
 HTML5?
 Local Storage?
 Web Sockets?
 http://phantomjs.org/
 Node.js
 Backbone.js
Presenter: Sathyan, Mindfire Solutions
Thank you

Weitere ähnliche Inhalte

Ähnlich wie Performance Best Practices - Part 1 - Client Side [JS, CSS, HTML, jQuery]

AtlasCamp 2011 - Five Strategies to Accelerate Plugin Development
AtlasCamp 2011 - Five Strategies to Accelerate Plugin DevelopmentAtlasCamp 2011 - Five Strategies to Accelerate Plugin Development
AtlasCamp 2011 - Five Strategies to Accelerate Plugin Developmentmrdon
 
Web Performance, Scalability, and Testing Techniques - Boston PHP Meetup
Web Performance, Scalability, and Testing Techniques - Boston PHP MeetupWeb Performance, Scalability, and Testing Techniques - Boston PHP Meetup
Web Performance, Scalability, and Testing Techniques - Boston PHP MeetupJonathan Klein
 
Introduction to Client Side Dev in SharePoint Workshop
Introduction to Client Side Dev in SharePoint WorkshopIntroduction to Client Side Dev in SharePoint Workshop
Introduction to Client Side Dev in SharePoint WorkshopMark Rackley
 
3 Tips to Deliver Fast Performance Across Mobile Web
3 Tips to Deliver Fast Performance Across Mobile Web3 Tips to Deliver Fast Performance Across Mobile Web
3 Tips to Deliver Fast Performance Across Mobile WebDynatrace
 
Sinatra and JSONQuery Web Service
Sinatra and JSONQuery Web ServiceSinatra and JSONQuery Web Service
Sinatra and JSONQuery Web Servicevvatikiotis
 
Web Development for UX Designers
Web Development for UX DesignersWeb Development for UX Designers
Web Development for UX DesignersAshlimarie
 
Robotlegs on Top of Gaia
Robotlegs on Top of GaiaRobotlegs on Top of Gaia
Robotlegs on Top of GaiaJesse Warden
 
Ruby on Rails Performance Tuning. Make it faster, make it better (WindyCityRa...
Ruby on Rails Performance Tuning. Make it faster, make it better (WindyCityRa...Ruby on Rails Performance Tuning. Make it faster, make it better (WindyCityRa...
Ruby on Rails Performance Tuning. Make it faster, make it better (WindyCityRa...John McCaffrey
 
Windy cityrails performance_tuning
Windy cityrails performance_tuningWindy cityrails performance_tuning
Windy cityrails performance_tuningJohn McCaffrey
 
JBUG 11 - Django-The Web Framework For Perfectionists With Deadlines
JBUG 11 - Django-The Web Framework For Perfectionists With DeadlinesJBUG 11 - Django-The Web Framework For Perfectionists With Deadlines
JBUG 11 - Django-The Web Framework For Perfectionists With DeadlinesTikal Knowledge
 
Ajax to the Moon
Ajax to the MoonAjax to the Moon
Ajax to the Moondavejohnson
 
Beyond the Basics, Debugging with Firebug and Web Inspector
Beyond the Basics, Debugging with Firebug and Web InspectorBeyond the Basics, Debugging with Firebug and Web Inspector
Beyond the Basics, Debugging with Firebug and Web InspectorSteven Roussey
 
From Zero to Hero – Web Performance
From Zero to Hero – Web PerformanceFrom Zero to Hero – Web Performance
From Zero to Hero – Web PerformanceSebastian Springer
 
Intro to-html-backbone
Intro to-html-backboneIntro to-html-backbone
Intro to-html-backbonezonathen
 
Our application got popular and now it breaks
Our application got popular and now it breaksOur application got popular and now it breaks
Our application got popular and now it breaksColdFusionConference
 
Our application got popular and now it breaks
Our application got popular and now it breaksOur application got popular and now it breaks
Our application got popular and now it breaksdevObjective
 
WPF for developers - optimizing your WPF application
WPF for developers - optimizing your WPF applicationWPF for developers - optimizing your WPF application
WPF for developers - optimizing your WPF applicationTamir Khason
 
(In)Security Implication in the JS Universe
(In)Security Implication in the JS Universe(In)Security Implication in the JS Universe
(In)Security Implication in the JS UniverseStefano Di Paola
 
Optimizing Flex Applications
Optimizing Flex ApplicationsOptimizing Flex Applications
Optimizing Flex Applicationsdcoletta
 
Joomla Day Austin Part 4
Joomla Day Austin Part 4Joomla Day Austin Part 4
Joomla Day Austin Part 4Kyle Ledbetter
 

Ähnlich wie Performance Best Practices - Part 1 - Client Side [JS, CSS, HTML, jQuery] (20)

AtlasCamp 2011 - Five Strategies to Accelerate Plugin Development
AtlasCamp 2011 - Five Strategies to Accelerate Plugin DevelopmentAtlasCamp 2011 - Five Strategies to Accelerate Plugin Development
AtlasCamp 2011 - Five Strategies to Accelerate Plugin Development
 
Web Performance, Scalability, and Testing Techniques - Boston PHP Meetup
Web Performance, Scalability, and Testing Techniques - Boston PHP MeetupWeb Performance, Scalability, and Testing Techniques - Boston PHP Meetup
Web Performance, Scalability, and Testing Techniques - Boston PHP Meetup
 
Introduction to Client Side Dev in SharePoint Workshop
Introduction to Client Side Dev in SharePoint WorkshopIntroduction to Client Side Dev in SharePoint Workshop
Introduction to Client Side Dev in SharePoint Workshop
 
3 Tips to Deliver Fast Performance Across Mobile Web
3 Tips to Deliver Fast Performance Across Mobile Web3 Tips to Deliver Fast Performance Across Mobile Web
3 Tips to Deliver Fast Performance Across Mobile Web
 
Sinatra and JSONQuery Web Service
Sinatra and JSONQuery Web ServiceSinatra and JSONQuery Web Service
Sinatra and JSONQuery Web Service
 
Web Development for UX Designers
Web Development for UX DesignersWeb Development for UX Designers
Web Development for UX Designers
 
Robotlegs on Top of Gaia
Robotlegs on Top of GaiaRobotlegs on Top of Gaia
Robotlegs on Top of Gaia
 
Ruby on Rails Performance Tuning. Make it faster, make it better (WindyCityRa...
Ruby on Rails Performance Tuning. Make it faster, make it better (WindyCityRa...Ruby on Rails Performance Tuning. Make it faster, make it better (WindyCityRa...
Ruby on Rails Performance Tuning. Make it faster, make it better (WindyCityRa...
 
Windy cityrails performance_tuning
Windy cityrails performance_tuningWindy cityrails performance_tuning
Windy cityrails performance_tuning
 
JBUG 11 - Django-The Web Framework For Perfectionists With Deadlines
JBUG 11 - Django-The Web Framework For Perfectionists With DeadlinesJBUG 11 - Django-The Web Framework For Perfectionists With Deadlines
JBUG 11 - Django-The Web Framework For Perfectionists With Deadlines
 
Ajax to the Moon
Ajax to the MoonAjax to the Moon
Ajax to the Moon
 
Beyond the Basics, Debugging with Firebug and Web Inspector
Beyond the Basics, Debugging with Firebug and Web InspectorBeyond the Basics, Debugging with Firebug and Web Inspector
Beyond the Basics, Debugging with Firebug and Web Inspector
 
From Zero to Hero – Web Performance
From Zero to Hero – Web PerformanceFrom Zero to Hero – Web Performance
From Zero to Hero – Web Performance
 
Intro to-html-backbone
Intro to-html-backboneIntro to-html-backbone
Intro to-html-backbone
 
Our application got popular and now it breaks
Our application got popular and now it breaksOur application got popular and now it breaks
Our application got popular and now it breaks
 
Our application got popular and now it breaks
Our application got popular and now it breaksOur application got popular and now it breaks
Our application got popular and now it breaks
 
WPF for developers - optimizing your WPF application
WPF for developers - optimizing your WPF applicationWPF for developers - optimizing your WPF application
WPF for developers - optimizing your WPF application
 
(In)Security Implication in the JS Universe
(In)Security Implication in the JS Universe(In)Security Implication in the JS Universe
(In)Security Implication in the JS Universe
 
Optimizing Flex Applications
Optimizing Flex ApplicationsOptimizing Flex Applications
Optimizing Flex Applications
 
Joomla Day Austin Part 4
Joomla Day Austin Part 4Joomla Day Austin Part 4
Joomla Day Austin Part 4
 

Mehr von Mindfire Solutions (20)

Physician Search and Review
Physician Search and ReviewPhysician Search and Review
Physician Search and Review
 
diet management app
diet management appdiet management app
diet management app
 
Business Technology Solution
Business Technology SolutionBusiness Technology Solution
Business Technology Solution
 
Remote Health Monitoring
Remote Health MonitoringRemote Health Monitoring
Remote Health Monitoring
 
Influencer Marketing Solution
Influencer Marketing SolutionInfluencer Marketing Solution
Influencer Marketing Solution
 
ELMAH
ELMAHELMAH
ELMAH
 
High Availability of Azure Applications
High Availability of Azure ApplicationsHigh Availability of Azure Applications
High Availability of Azure Applications
 
IOT Hands On
IOT Hands OnIOT Hands On
IOT Hands On
 
Glimpse of Loops Vs Set
Glimpse of Loops Vs SetGlimpse of Loops Vs Set
Glimpse of Loops Vs Set
 
Oracle Sql Developer-Getting Started
Oracle Sql Developer-Getting StartedOracle Sql Developer-Getting Started
Oracle Sql Developer-Getting Started
 
Adaptive Layout In iOS 8
Adaptive Layout In iOS 8Adaptive Layout In iOS 8
Adaptive Layout In iOS 8
 
Introduction to Auto-layout : iOS/Mac
Introduction to Auto-layout : iOS/MacIntroduction to Auto-layout : iOS/Mac
Introduction to Auto-layout : iOS/Mac
 
LINQPad - utility Tool
LINQPad - utility ToolLINQPad - utility Tool
LINQPad - utility Tool
 
Get started with watch kit development
Get started with watch kit developmentGet started with watch kit development
Get started with watch kit development
 
Swift vs Objective-C
Swift vs Objective-CSwift vs Objective-C
Swift vs Objective-C
 
Material Design in Android
Material Design in AndroidMaterial Design in Android
Material Design in Android
 
Introduction to OData
Introduction to ODataIntroduction to OData
Introduction to OData
 
Ext js Part 2- MVC
Ext js Part 2- MVCExt js Part 2- MVC
Ext js Part 2- MVC
 
ExtJs Basic Part-1
ExtJs Basic Part-1ExtJs Basic Part-1
ExtJs Basic Part-1
 
Spring Security Introduction
Spring Security IntroductionSpring Security Introduction
Spring Security Introduction
 

Kürzlich hochgeladen

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 educationjfdjdjcjdnsjd
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?Igalia
 
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 WorkerThousandEyes
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)wesley chun
 
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
 
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 DevelopmentsTrustArc
 
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
 
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 ModelDeepika Singh
 
Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024The Digital Insurer
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...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
 
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
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDropbox
 
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
 
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 WoodJuan lago vázquez
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native ApplicationsWSO2
 
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
 
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Zilliz
 
Ransomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfRansomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfOverkill Security
 

Kürzlich hochgeladen (20)

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
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
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
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
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
 
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 - 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, ...
 
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
 
+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...
 
Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
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
 
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
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
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
 
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
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
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...
 
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
 
Ransomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfRansomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdf
 

Performance Best Practices - Part 1 - Client Side [JS, CSS, HTML, jQuery]

  • 1. Performance Best Practices - Part 1 - Client Side [JS, CSS, HTML, jQuery] Presenter: Sathyan, Mindfire Solutions Date: 03rd Sep 2013
  • 3. Presenter: Sathyan, Mindfire Solutions  Average Frontend time is 75% and above  No inline JavaScript  No Inline Styles  Refer only the necessary include [js, css, etc.] files for the page  Always remove code, DOM, CSS that you do not need – Sample  Minimal comments, comment only what the code does and not how!  Use JSON  Less less less
  • 4. Presenter: Sathyan, Mindfire Solutions  Minimize HTTP Requests  Put Stylesheets at the Top  Put Scripts at the Bottom  Avoid Redirects  Make Ajax Cacheable  Use GET for AJAX Requests  Post-load Components  Preload Components  Reduce the Number of DOM Elements
  • 6.  JAX  What?  Really?  AJAX Control Toolkit  But I need It…  Callback  Read  See Presenter: Sathyan, Mindfire Solutions
  • 7. Presenter: Sathyan, Mindfire Solutions  CSS Sprites  http://www.websiteoptimization.com/speed/ tweak/css-sprites/  Replace graphic rollovers with CSS rollovers  colored backgrounds, borders, or spacing instead of graphic techniques  Replace graphic text headers with CSS text headers
  • 8. Presenter: Sathyan, Mindfire Solutions  Use efficient CSS selectors ◦ Right to left $(“body #container div a”) ◦ Rules with descendants body * {...}.hide-scrollbars * {...} ◦ Rules with child or adjacent selectors body > * {...}.hide- scrollbars * {...} ◦ Rules with overly qualified selectors – IDs with tags ◦ Remove redundant qualifiers.  Avoid CSS expressions [ IE 5 – 7]  Put CSS in the document head  Specify image dimensions  Specify a character set
  • 9. Presenter: Sathyan, Mindfire Solutions  CSS 3 ?  Group Similar Styles  Reduce No of line breaks  Simple colors #333333, #DDDDDD, #112255, #AABBCC, #FF0000 to #333, #DDD, #125, #ABC, #F00  Remove “px”  Images
  • 10. Presenter: Sathyan, Mindfire Solutions  Scroll, Resize   Chrome Developer Tools – Profiles – flipkart  CSS Stress Test  Chrome Developer Tools – Timeline Ctrl E R flipkart  Chrome Developer Tools –Audit
  • 11. Presenter: Sathyan, Mindfire Solutions  Native JS Code  Grouping  Reuse  Caching  Refer an element as directly as possible using the ID selector rather than using search/find in a container, yes that is right, because it translates directly to good old getElementByID()
  • 12.  Concat with Array.prototype.join() – Really?  Data Structures Push() pop() Shift() - Read  Use ‘this’  Switch it!  Loops $.each() Vs Native  Initializing instance variables  Know your Closures  Cache – $(".someelement") -- Assign to a Var! Presenter: Sathyan, Mindfire Solutions
  • 13. Presenter: Sathyan, Mindfire Solutions  Always Unbind before binding  Most abused part  Leads to repeated calls  Repeated requests leads to pathetic web page  See
  • 14.  DOM Manipulation is BAD for (var ct=0; ct <1000; ++ct) { $("#header").html($("#header").html() + ‘something from resultset’); } should be written as: var fullHeaderContent = $("#header").html(); for (var ct=0; ct <1000; ++ct) { fullHeaderContent += ‘something from resultset’; } $("#header").html(fullHeaderContent ); Presenter: Sathyan, Mindfire Solutions
  • 15. //BAD for (var ctPatient=0; ctPatient<=rows.length; ++ctPatient) { $('#alertResult').append('<tr><td>'+rows[ctPatient]+'</td></tr>'); } // AWESOME var domTree = ''; for (var ctPatient=0; ctPatient<=rows.length; ++ctPatient) { domTree += '<tr><td>'+rows[ctPatient]+'</td></tr>'; } $('#alertResult').append(domTree); Presenter: Sathyan, Mindfire Solutions
  • 16. Presenter: Sathyan, Mindfire Solutions  Avoid using pseudo and attribute selectors ◦ $(‘:visible, :hidden’); $(’[attribute=value]’);  Class Selectors Next Slower [IE9]  Tags!  ID ID ID ID  Chaining – Multi Selectors  Sizzle
  • 17.  Depth of call stack  Rapid fire rounds – 2 to 3 milliseconds  Even bubbling – Super Post  Mouseup Vs Click Presenter: Sathyan, Mindfire Solutions
  • 18. $("#longlist li").on("mouseenter", function() { $(this).text("Click me!"); }); $("#longlist li").on("click", function() { $(this).text("Why did you click me?!"); }); var list = $("#longlist"); list.on("mouseenter", "li", function(){ $(this).text("Click me!"); }); list.on("click", "li", function() { $(this).text("Why did you click me?!"); }); http://gregfranko.com/jquery-best-practices/#/20
  • 19.  Hello World!  Why?  Options?  Window Events? Presenter: Sathyan, Mindfire Solutions
  • 20.  It matters  The latest is the greatest, always Presenter: Sathyan, Mindfire Solutions
  • 21.  The best Javascript debugger out there!  Console shows warning, errors, info  Look for Yellow and Red – If you see them, they are bad, get rid of those warnings, errors right away!  Do you see 404? Bad, Very Bad, Please act on it  Are there repeated calls? No use of “stressing” the point here, get rid of duplicate calls.  Net Tab – Wait time - receive time Presenter: Sathyan, Mindfire Solutions
  • 22.  Asynch Calls for Wait time  Number of requests – can they be reduced? Are there repeated calls? Where is the most time spent?  Categorize the bottlenecks using the waterfall charts  console.profile, console.time and other Console APIs are very powerful, learn and use http://getfirebug.com/wiki/index.php/Conso le_API Presenter: Sathyan, Mindfire Solutions
  • 23.  Yslow ◦ Use a Content Delivery Network (CDN) ◦ Add Expires headers ◦ Avoid empty src or href ◦ Compress components with gzip ◦ Configure entity tags (ETags) ◦ Make favicon small and cacheable ◦ Minification ◦ Bundling ◦ One Big JS/CSS Presenter: Sathyan, Mindfire Solutions
  • 24.  uniform way to analyze and report on the degree to which measured performance meets user expectations.  Set Your Apdex Score  Et Your Apdex Score Presenter: Sathyan, Mindfire Solutions
  • 25.  Chrome Developer Tools – Audit  Miniprofiler  Glimpse  Firebug - Network  Yslow  PageSpeed  Newrelic  http://www.webpagetest.org/  https://code.google.com/p/leak-finder-for- javascript/ Presenter: Sathyan, Mindfire Solutions
  • 27. Presenter: Sathyan, Mindfire Solutions  http://www.stevesouders.com  http://www.websiteoptimization.com/  http://www.webpagetest.org/  http://webdevchecklist.com/asp.net/performance/  http://www.strangeloopnetworks.com/assets/images/visualizing_web_performance_pos ter.jpg  https://developers.google.com/speed/pagespeed/?csw=1  https://developers.google.com/speed/docs/best-practices/rendering  http://oreilly.com/server-administration/excerpts/even-faster-websites/writing- efficient-javascript.html  http://gregfranko.com/jquery-best-practices/#/  http://www.artzstudio.com/2009/04/jquery-performance-rules/  http://vimeo.com/43659068  http://addyosmani.com/blog/  http://www.webperformancetoday.com/2010/07/09/waterfalls-101/
  • 28. Presenter: Sathyan, Mindfire Solutions Question and Answer  HTML5?  Local Storage?  Web Sockets?  http://phantomjs.org/  Node.js  Backbone.js
  • 29. Presenter: Sathyan, Mindfire Solutions Thank you