SlideShare ist ein Scribd-Unternehmen logo
1 von 17
CIGNEX Datamatics Confidential www.cignex.com
Web Performance Tuning in Front-end Perspective
Ver : 1.0
Name: Sendhil Kumar K
Title: Web Performance Tuning
in Front-end Perspective
CIGNEX Datamatics Confidential www.cignex.com
• 80% of the end-user response time is spent on the front-end. Most of this time is tied
up in downloading all the components in the page: images, stylesheets, scripts, Flash,
etc.
2
Best Practices for Speeding Up Your Web Site
CIGNEX Datamatics Confidential www.cignex.com
Why is speed important?
• Offers a good user experience
• No broken functionality
• Doesn't make one feel like they are living in the 90s
CIGNEX Datamatics Confidential www.cignex.com
Cross-platform
CIGNEX Datamatics Confidential www.cignex.com
JS Minification
/**
* This, friends, is a very important function.
*/
function examplefunction(){
var be = true;
if(be){
confirm("You sure about that?");
}else if(!be){
Confirm("Apparently not.")
}
}
function examplefunction(){var be=true;if(be)
{confirm("You sure about that?");}else if(!be)
{Confirm("Apparently not.")}};
• Reduce the size of the Javascript files.
• Reduce the total response sizes.
• Reduced bandwidth significantly
Original size: 205 Minified size: 121 41%
CIGNEX Datamatics Confidential www.cignex.com
JS Obfuscation (harder to understand)
function exampleFunction(){
Var aLongerThanNecessaryVariableName =
true;
if(aLongerThanNecessaryVariableName){
confirm("You sure about that?");
}else if(!aLongerThanNecessaryVariableName){
confirm("Apparently not.");
}
}
function exampleFunction(){
Var a = true;
if(a){
confirm("You sure about that?");
}else if(!a){
confirm("Apparently not.");
}
}
• Reduce the lenght of variables names
• Be careful the obfuscation method (e.g., eval cause performance degradation)
• Be careful the conflicts.
Original size: 238 Obfuscation size: 145 39%
CIGNEX Datamatics Confidential www.cignex.com
Combined (css, js)
CSS
<link href="./css/custom.css" rel="stylesheet" type="text/css">
<link href="./css/custom_responsive.css" rel="stylesheet" type="text/css">
JS
<script src="./js/custom.js"></script>
<script src="./js/custom_responsive.js"></script>
<link href="./css/combination.css" rel="stylesheet" type="text/css">
<script src="./js/combination.js"></script>
• Reduce the HTTP requrest.
• Reduce the size and load fast
CIGNEX Datamatics Confidential www.cignex.com
<head>
<link href="./css/custom.css" rel="stylesheet" type="text/css">
<link href="./css/custom_responsive.css" rel="stylesheet" type="text/css">
</head>
<body>
..
..
<script src="./js/custom.js" type="text/javascript"></script>
<script src="./js/custom_responsive.js" type="text/javascript"></script>
</body>
Source Order
<head>
<script src="./js/custom.js"></script>
<script src="./js/custom_responsive.js"></script>
<link href="./css/custom.css" rel="stylesheet" type="text/css">
<link href="./css/custom_responsive.css" rel="stylesheet"
type="text/css">
</head>
<body>
..
..
</body>
• Keep CSS at Top
• Keep JavaScripts at the Bottom
• Drop all inline styles if possible and don't use browser specific CSS effects (esp. IE)
• Use <link> to include stylesheets
- @import MUST preceded all other rules
- @import may cause blank white screen phenomenon (in IE)
CIGNEX Datamatics Confidential www.cignex.com
• CSS Sprites: Combine N icons into 1 bigger image.
– Reduce N requests into 1 requrest.
– Be careful of the arrangement of the icons
– Tool: http://www.tw.spritegen.website-performance.org/
http://csssprites.com/
• Minimize, cut snip, chop
– Minimize DOM elements. Slows donw JS
– Iframes are heavy and block onload event
– Minimize 3rd party script. See if you load those asynchronously
– Reduce the cookie size.
– Optimize images, use PNG instead of GIF.
– Using appropriate image format and remove redundant chunks in the image files.
– PNG8 (256 color) is a good choice.
– Reduce JPG quality. Tools like jpgtran, pngcrush, optipng will help
– Avoid image scaling
9
Make Fewer Requests
CIGNEX Datamatics Confidential www.cignex.com
– Use JSON in AJAX requests
– Use GET in Ajax requests
– Prefer CSS over JSON
– Font optimizing
– Lazy load for Images
– Avoid Flash files
– Mobile-specific optimisations
Make Fewer Requests ( Minimize, cut snip, chop...)
CIGNEX Datamatics Confidential www.cignex.com
Browser-Based Tools
CIGNEX Datamatics Confidential www.cignex.com
YSlow (Add-on)
http://developer.yahoo.com/yslow/
• YSlow analyzes web page performance by examining all the components on the
page, including components dynamically created by using JavaScript. It measures the
page's performance and offers suggestions for improvement.
CIGNEX Datamatics Confidential www.cignex.com
Page Speed
• Useful to detect our website performance
• Gives two scores: desktop and mobile
• LIsts everything we can improve
https://developers.google.com/speed/pagespeed/?csw=1
Firefox Add-on
CIGNEX Datamatics Confidential www.cignex.com
Other tools
• FireBug (Net tab)
• Firecookie (Firecookie is an extension for Firebug that makes possible to view and manage cookies in
your browser)
• Live HTTP Headers (View HTTP headers of a page and while browsing.)
• Chrome, Safari, IE developer tools
CIGNEX Datamatics Confidential www.cignex.com
List of best practices
CIGNEX Datamatics Confidential www.cignex.com
Simplifying CSS Selectors
• CSS selector policy: Rightmost-First
• Tips:
– Avoid * selector
– Don’t qualify ID/CSS selectors
– Specific rules
– Avoid descendant selectors
– Avoid Tag > Child selectors
– Rely on Inheritance
CIGNEX Datamatics Confidential www.cignex.com
 http://developer.yahoo.com/performance/rules.html - Yahoo
 http://developer.mozilla.org/en/docs/Writing_Efficient_CSS - CSS Guidelines
 http://www.alistapart.com/articles/sprites - CSS Sprites
 http://www.javascripttoolbox.com/bestpractices/ - Javascript best practices
 http://www.getfirebug.com/ - FireBug
 http://www.julienlecomte.net/ - A nice blog
 http://stevesouders.com/cuzillion/ - Place scripts & other resources tester
 http://quirksmode.org/
 Other references: Jquery, GWT, YUI, Ajaxian
 Future - Ajax tied up with desktop web, other gadgets.
 Douglaus crockford - Yahoo videos about Javascript, DOM, Advanced JS
 Google I/O videos about web site performance tuning.
Referances

Weitere ähnliche Inhalte

Was ist angesagt?

Performance Test Analysis- Hotels
Performance Test Analysis- HotelsPerformance Test Analysis- Hotels
Performance Test Analysis- Hotels
yassine Alozade
 

Was ist angesagt? (20)

NextJS, A JavaScript Framework for building next generation SPA
NextJS, A JavaScript Framework for building next generation SPA  NextJS, A JavaScript Framework for building next generation SPA
NextJS, A JavaScript Framework for building next generation SPA
 
Client Side Performance @ Xero
Client Side Performance @ XeroClient Side Performance @ Xero
Client Side Performance @ Xero
 
AEM responsive
AEM responsiveAEM responsive
AEM responsive
 
Building fast aspnet websites
Building fast aspnet websitesBuilding fast aspnet websites
Building fast aspnet websites
 
Optimizing WordPress for Speed and Conversions
Optimizing WordPress for Speed and ConversionsOptimizing WordPress for Speed and Conversions
Optimizing WordPress for Speed and Conversions
 
jQuery 1.9 and 2.0 - Present and Future
jQuery 1.9 and 2.0 - Present and FuturejQuery 1.9 and 2.0 - Present and Future
jQuery 1.9 and 2.0 - Present and Future
 
Progressive Web Apps: o melhor da Web appficada
Progressive Web Apps: o melhor da Web appficadaProgressive Web Apps: o melhor da Web appficada
Progressive Web Apps: o melhor da Web appficada
 
DeepCrawl Webinar: Performing SEO on the Edge
DeepCrawl Webinar: Performing SEO on the EdgeDeepCrawl Webinar: Performing SEO on the Edge
DeepCrawl Webinar: Performing SEO on the Edge
 
Next.js in production by Jasdeep Lalli
Next.js in production by Jasdeep Lalli Next.js in production by Jasdeep Lalli
Next.js in production by Jasdeep Lalli
 
How webpage loading takes place?
How webpage loading takes place?How webpage loading takes place?
How webpage loading takes place?
 
Performance Test Analysis- Hotels
Performance Test Analysis- HotelsPerformance Test Analysis- Hotels
Performance Test Analysis- Hotels
 
Client side performance analysis
Client side performance analysisClient side performance analysis
Client side performance analysis
 
Biwug
BiwugBiwug
Biwug
 
10 things to do to speed up your site
10 things to do to speed up your site10 things to do to speed up your site
10 things to do to speed up your site
 
Responsive design in plone
Responsive design in ploneResponsive design in plone
Responsive design in plone
 
Why AngularJs
Why AngularJsWhy AngularJs
Why AngularJs
 
BrightonSEO 2019 - Edge SEO - Using CDNs To Perform SEO On The Edge
BrightonSEO 2019 - Edge SEO - Using CDNs To Perform SEO On The EdgeBrightonSEO 2019 - Edge SEO - Using CDNs To Perform SEO On The Edge
BrightonSEO 2019 - Edge SEO - Using CDNs To Perform SEO On The Edge
 
Web Performance: 3 Stages to Success
Web Performance: 3 Stages to SuccessWeb Performance: 3 Stages to Success
Web Performance: 3 Stages to Success
 
Angular js
Angular jsAngular js
Angular js
 
Effectively Monitoring Client-Side Performance
Effectively Monitoring Client-Side PerformanceEffectively Monitoring Client-Side Performance
Effectively Monitoring Client-Side Performance
 

Andere mochten auch

Andere mochten auch (8)

git
gitgit
git
 
Stats stif-transports-idf-janvier-2016-2
Stats stif-transports-idf-janvier-2016-2Stats stif-transports-idf-janvier-2016-2
Stats stif-transports-idf-janvier-2016-2
 
Front end performance optimization
Front end performance optimizationFront end performance optimization
Front end performance optimization
 
Front end performance tip
Front end performance tipFront end performance tip
Front end performance tip
 
Building a High Performance WordPress Environment - WordCamp NYC 2010
Building a High Performance WordPress Environment - WordCamp NYC 2010Building a High Performance WordPress Environment - WordCamp NYC 2010
Building a High Performance WordPress Environment - WordCamp NYC 2010
 
Front End Performance
Front End PerformanceFront End Performance
Front End Performance
 
London Web Performance Meetup: Performance for mortal companies
London Web Performance Meetup: Performance for mortal companiesLondon Web Performance Meetup: Performance for mortal companies
London Web Performance Meetup: Performance for mortal companies
 
Bootstrap with liferay
Bootstrap with liferayBootstrap with liferay
Bootstrap with liferay
 

Ähnlich wie Web performance tuning

The High Performance Web Application Lifecycle
The High Performance Web Application LifecycleThe High Performance Web Application Lifecycle
The High Performance Web Application Lifecycle
Alois Reitbauer
 
[convergese] Adaptive Images in Responsive Web Design
[convergese] Adaptive Images in Responsive Web Design[convergese] Adaptive Images in Responsive Web Design
[convergese] Adaptive Images in Responsive Web Design
Christopher Schmitt
 

Ähnlich wie Web performance tuning (20)

The High Performance Web Application Lifecycle
The High Performance Web Application LifecycleThe High Performance Web Application Lifecycle
The High Performance Web Application Lifecycle
 
12 GoMeasure (sg and kl) - page speed light speed path to conversions - joh...
12   GoMeasure (sg and kl) - page speed light speed path to conversions - joh...12   GoMeasure (sg and kl) - page speed light speed path to conversions - joh...
12 GoMeasure (sg and kl) - page speed light speed path to conversions - joh...
 
Presentation Tier optimizations
Presentation Tier optimizationsPresentation Tier optimizations
Presentation Tier optimizations
 
Build Better Responsive websites. Hrvoje Jurišić
Build Better Responsive websites. Hrvoje JurišićBuild Better Responsive websites. Hrvoje Jurišić
Build Better Responsive websites. Hrvoje Jurišić
 
Optimizing your WordPress website
Optimizing your WordPress websiteOptimizing your WordPress website
Optimizing your WordPress website
 
Modelling Web Performance Optimization - FFSUx
Modelling  Web Performance Optimization - FFSUxModelling  Web Performance Optimization - FFSUx
Modelling Web Performance Optimization - FFSUx
 
[convergese] Adaptive Images in Responsive Web Design
[convergese] Adaptive Images in Responsive Web Design[convergese] Adaptive Images in Responsive Web Design
[convergese] Adaptive Images in Responsive Web Design
 
The Need for Speed - SMX Sydney 2013
The Need for Speed - SMX Sydney 2013The Need for Speed - SMX Sydney 2013
The Need for Speed - SMX Sydney 2013
 
VizEx View HTML5 Workshop
VizEx View HTML5 WorkshopVizEx View HTML5 Workshop
VizEx View HTML5 Workshop
 
VizEx View HTML5 Workshop
VizEx View HTML5 WorkshopVizEx View HTML5 Workshop
VizEx View HTML5 Workshop
 
Website Optimization How to Increase Page Performance and More
Website Optimization How to Increase Page Performance and More Website Optimization How to Increase Page Performance and More
Website Optimization How to Increase Page Performance and More
 
20 tips for website performance
20 tips for website performance20 tips for website performance
20 tips for website performance
 
Developing High Performance Web Apps - CodeMash 2011
Developing High Performance Web Apps - CodeMash 2011Developing High Performance Web Apps - CodeMash 2011
Developing High Performance Web Apps - CodeMash 2011
 
SearchLove San Diego 2018 | Mat Clayton | Site Speed for Digital Marketers
SearchLove San Diego 2018 | Mat Clayton | Site Speed for Digital MarketersSearchLove San Diego 2018 | Mat Clayton | Site Speed for Digital Marketers
SearchLove San Diego 2018 | Mat Clayton | Site Speed for Digital Marketers
 
PrairieDevCon 2014 - Web Doesn't Mean Slow
PrairieDevCon 2014 -  Web Doesn't Mean SlowPrairieDevCon 2014 -  Web Doesn't Mean Slow
PrairieDevCon 2014 - Web Doesn't Mean Slow
 
performance.ppt
performance.pptperformance.ppt
performance.ppt
 
Developing High Performance Web Apps
Developing High Performance Web AppsDeveloping High Performance Web Apps
Developing High Performance Web Apps
 
JavaScript front end performance optimizations
JavaScript front end performance optimizationsJavaScript front end performance optimizations
JavaScript front end performance optimizations
 
AspNetWhitePaper
AspNetWhitePaperAspNetWhitePaper
AspNetWhitePaper
 
AspNetWhitePaper
AspNetWhitePaperAspNetWhitePaper
AspNetWhitePaper
 

Kürzlich hochgeladen

( Pune ) VIP Baner Call Girls 🎗️ 9352988975 Sizzling | Escorts | Girls Are Re...
( Pune ) VIP Baner Call Girls 🎗️ 9352988975 Sizzling | Escorts | Girls Are Re...( Pune ) VIP Baner Call Girls 🎗️ 9352988975 Sizzling | Escorts | Girls Are Re...
( Pune ) VIP Baner Call Girls 🎗️ 9352988975 Sizzling | Escorts | Girls Are Re...
nilamkumrai
 
Low Sexy Call Girls In Mohali 9053900678 🥵Have Save And Good Place 🥵
Low Sexy Call Girls In Mohali 9053900678 🥵Have Save And Good Place 🥵Low Sexy Call Girls In Mohali 9053900678 🥵Have Save And Good Place 🥵
Low Sexy Call Girls In Mohali 9053900678 🥵Have Save And Good Place 🥵
Chandigarh Call girls 9053900678 Call girls in Chandigarh
 
valsad Escorts Service ☎️ 6378878445 ( Sakshi Sinha ) High Profile Call Girls...
valsad Escorts Service ☎️ 6378878445 ( Sakshi Sinha ) High Profile Call Girls...valsad Escorts Service ☎️ 6378878445 ( Sakshi Sinha ) High Profile Call Girls...
valsad Escorts Service ☎️ 6378878445 ( Sakshi Sinha ) High Profile Call Girls...
Call Girls In Delhi Whatsup 9873940964 Enjoy Unlimited Pleasure
 
在线制作约克大学毕业证(yu毕业证)在读证明认证可查
在线制作约克大学毕业证(yu毕业证)在读证明认证可查在线制作约克大学毕业证(yu毕业证)在读证明认证可查
在线制作约克大学毕业证(yu毕业证)在读证明认证可查
ydyuyu
 
➥🔝 7737669865 🔝▻ mehsana Call-girls in Women Seeking Men 🔝mehsana🔝 Escorts...
➥🔝 7737669865 🔝▻ mehsana Call-girls in Women Seeking Men  🔝mehsana🔝   Escorts...➥🔝 7737669865 🔝▻ mehsana Call-girls in Women Seeking Men  🔝mehsana🔝   Escorts...
➥🔝 7737669865 🔝▻ mehsana Call-girls in Women Seeking Men 🔝mehsana🔝 Escorts...
nirzagarg
 

Kürzlich hochgeladen (20)

( Pune ) VIP Baner Call Girls 🎗️ 9352988975 Sizzling | Escorts | Girls Are Re...
( Pune ) VIP Baner Call Girls 🎗️ 9352988975 Sizzling | Escorts | Girls Are Re...( Pune ) VIP Baner Call Girls 🎗️ 9352988975 Sizzling | Escorts | Girls Are Re...
( Pune ) VIP Baner Call Girls 🎗️ 9352988975 Sizzling | Escorts | Girls Are Re...
 
Shikrapur - Call Girls in Pune Neha 8005736733 | 100% Gennuine High Class Ind...
Shikrapur - Call Girls in Pune Neha 8005736733 | 100% Gennuine High Class Ind...Shikrapur - Call Girls in Pune Neha 8005736733 | 100% Gennuine High Class Ind...
Shikrapur - Call Girls in Pune Neha 8005736733 | 100% Gennuine High Class Ind...
 
Wagholi & High Class Call Girls Pune Neha 8005736733 | 100% Gennuine High Cla...
Wagholi & High Class Call Girls Pune Neha 8005736733 | 100% Gennuine High Cla...Wagholi & High Class Call Girls Pune Neha 8005736733 | 100% Gennuine High Cla...
Wagholi & High Class Call Girls Pune Neha 8005736733 | 100% Gennuine High Cla...
 
Ganeshkhind ! Call Girls Pune - 450+ Call Girl Cash Payment 8005736733 Neha T...
Ganeshkhind ! Call Girls Pune - 450+ Call Girl Cash Payment 8005736733 Neha T...Ganeshkhind ! Call Girls Pune - 450+ Call Girl Cash Payment 8005736733 Neha T...
Ganeshkhind ! Call Girls Pune - 450+ Call Girl Cash Payment 8005736733 Neha T...
 
Yerawada ] Independent Escorts in Pune - Book 8005736733 Call Girls Available...
Yerawada ] Independent Escorts in Pune - Book 8005736733 Call Girls Available...Yerawada ] Independent Escorts in Pune - Book 8005736733 Call Girls Available...
Yerawada ] Independent Escorts in Pune - Book 8005736733 Call Girls Available...
 
Top Rated Pune Call Girls Daund ⟟ 6297143586 ⟟ Call Me For Genuine Sex Servi...
Top Rated  Pune Call Girls Daund ⟟ 6297143586 ⟟ Call Me For Genuine Sex Servi...Top Rated  Pune Call Girls Daund ⟟ 6297143586 ⟟ Call Me For Genuine Sex Servi...
Top Rated Pune Call Girls Daund ⟟ 6297143586 ⟟ Call Me For Genuine Sex Servi...
 
Pirangut | Call Girls Pune Phone No 8005736733 Elite Escort Service Available...
Pirangut | Call Girls Pune Phone No 8005736733 Elite Escort Service Available...Pirangut | Call Girls Pune Phone No 8005736733 Elite Escort Service Available...
Pirangut | Call Girls Pune Phone No 8005736733 Elite Escort Service Available...
 
Low Sexy Call Girls In Mohali 9053900678 🥵Have Save And Good Place 🥵
Low Sexy Call Girls In Mohali 9053900678 🥵Have Save And Good Place 🥵Low Sexy Call Girls In Mohali 9053900678 🥵Have Save And Good Place 🥵
Low Sexy Call Girls In Mohali 9053900678 🥵Have Save And Good Place 🥵
 
Microsoft Azure Arc Customer Deck Microsoft
Microsoft Azure Arc Customer Deck MicrosoftMicrosoft Azure Arc Customer Deck Microsoft
Microsoft Azure Arc Customer Deck Microsoft
 
Real Escorts in Al Nahda +971524965298 Dubai Escorts Service
Real Escorts in Al Nahda +971524965298 Dubai Escorts ServiceReal Escorts in Al Nahda +971524965298 Dubai Escorts Service
Real Escorts in Al Nahda +971524965298 Dubai Escorts Service
 
20240510 QFM016 Irresponsible AI Reading List April 2024.pdf
20240510 QFM016 Irresponsible AI Reading List April 2024.pdf20240510 QFM016 Irresponsible AI Reading List April 2024.pdf
20240510 QFM016 Irresponsible AI Reading List April 2024.pdf
 
valsad Escorts Service ☎️ 6378878445 ( Sakshi Sinha ) High Profile Call Girls...
valsad Escorts Service ☎️ 6378878445 ( Sakshi Sinha ) High Profile Call Girls...valsad Escorts Service ☎️ 6378878445 ( Sakshi Sinha ) High Profile Call Girls...
valsad Escorts Service ☎️ 6378878445 ( Sakshi Sinha ) High Profile Call Girls...
 
APNIC Updates presented by Paul Wilson at ARIN 53
APNIC Updates presented by Paul Wilson at ARIN 53APNIC Updates presented by Paul Wilson at ARIN 53
APNIC Updates presented by Paul Wilson at ARIN 53
 
Pune Airport ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready...
Pune Airport ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready...Pune Airport ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready...
Pune Airport ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready...
 
Dubai=Desi Dubai Call Girls O525547819 Outdoor Call Girls Dubai
Dubai=Desi Dubai Call Girls O525547819 Outdoor Call Girls DubaiDubai=Desi Dubai Call Girls O525547819 Outdoor Call Girls Dubai
Dubai=Desi Dubai Call Girls O525547819 Outdoor Call Girls Dubai
 
Call Now ☎ 8264348440 !! Call Girls in Green Park Escort Service Delhi N.C.R.
Call Now ☎ 8264348440 !! Call Girls in Green Park Escort Service Delhi N.C.R.Call Now ☎ 8264348440 !! Call Girls in Green Park Escort Service Delhi N.C.R.
Call Now ☎ 8264348440 !! Call Girls in Green Park Escort Service Delhi N.C.R.
 
Russian Call Girls Pune (Adult Only) 8005736733 Escort Service 24x7 Cash Pay...
Russian Call Girls Pune  (Adult Only) 8005736733 Escort Service 24x7 Cash Pay...Russian Call Girls Pune  (Adult Only) 8005736733 Escort Service 24x7 Cash Pay...
Russian Call Girls Pune (Adult Only) 8005736733 Escort Service 24x7 Cash Pay...
 
All Time Service Available Call Girls Mg Road 👌 ⏭️ 6378878445
All Time Service Available Call Girls Mg Road 👌 ⏭️ 6378878445All Time Service Available Call Girls Mg Road 👌 ⏭️ 6378878445
All Time Service Available Call Girls Mg Road 👌 ⏭️ 6378878445
 
在线制作约克大学毕业证(yu毕业证)在读证明认证可查
在线制作约克大学毕业证(yu毕业证)在读证明认证可查在线制作约克大学毕业证(yu毕业证)在读证明认证可查
在线制作约克大学毕业证(yu毕业证)在读证明认证可查
 
➥🔝 7737669865 🔝▻ mehsana Call-girls in Women Seeking Men 🔝mehsana🔝 Escorts...
➥🔝 7737669865 🔝▻ mehsana Call-girls in Women Seeking Men  🔝mehsana🔝   Escorts...➥🔝 7737669865 🔝▻ mehsana Call-girls in Women Seeking Men  🔝mehsana🔝   Escorts...
➥🔝 7737669865 🔝▻ mehsana Call-girls in Women Seeking Men 🔝mehsana🔝 Escorts...
 

Web performance tuning

  • 1. CIGNEX Datamatics Confidential www.cignex.com Web Performance Tuning in Front-end Perspective Ver : 1.0 Name: Sendhil Kumar K Title: Web Performance Tuning in Front-end Perspective
  • 2. CIGNEX Datamatics Confidential www.cignex.com • 80% of the end-user response time is spent on the front-end. Most of this time is tied up in downloading all the components in the page: images, stylesheets, scripts, Flash, etc. 2 Best Practices for Speeding Up Your Web Site
  • 3. CIGNEX Datamatics Confidential www.cignex.com Why is speed important? • Offers a good user experience • No broken functionality • Doesn't make one feel like they are living in the 90s
  • 4. CIGNEX Datamatics Confidential www.cignex.com Cross-platform
  • 5. CIGNEX Datamatics Confidential www.cignex.com JS Minification /** * This, friends, is a very important function. */ function examplefunction(){ var be = true; if(be){ confirm("You sure about that?"); }else if(!be){ Confirm("Apparently not.") } } function examplefunction(){var be=true;if(be) {confirm("You sure about that?");}else if(!be) {Confirm("Apparently not.")}}; • Reduce the size of the Javascript files. • Reduce the total response sizes. • Reduced bandwidth significantly Original size: 205 Minified size: 121 41%
  • 6. CIGNEX Datamatics Confidential www.cignex.com JS Obfuscation (harder to understand) function exampleFunction(){ Var aLongerThanNecessaryVariableName = true; if(aLongerThanNecessaryVariableName){ confirm("You sure about that?"); }else if(!aLongerThanNecessaryVariableName){ confirm("Apparently not."); } } function exampleFunction(){ Var a = true; if(a){ confirm("You sure about that?"); }else if(!a){ confirm("Apparently not."); } } • Reduce the lenght of variables names • Be careful the obfuscation method (e.g., eval cause performance degradation) • Be careful the conflicts. Original size: 238 Obfuscation size: 145 39%
  • 7. CIGNEX Datamatics Confidential www.cignex.com Combined (css, js) CSS <link href="./css/custom.css" rel="stylesheet" type="text/css"> <link href="./css/custom_responsive.css" rel="stylesheet" type="text/css"> JS <script src="./js/custom.js"></script> <script src="./js/custom_responsive.js"></script> <link href="./css/combination.css" rel="stylesheet" type="text/css"> <script src="./js/combination.js"></script> • Reduce the HTTP requrest. • Reduce the size and load fast
  • 8. CIGNEX Datamatics Confidential www.cignex.com <head> <link href="./css/custom.css" rel="stylesheet" type="text/css"> <link href="./css/custom_responsive.css" rel="stylesheet" type="text/css"> </head> <body> .. .. <script src="./js/custom.js" type="text/javascript"></script> <script src="./js/custom_responsive.js" type="text/javascript"></script> </body> Source Order <head> <script src="./js/custom.js"></script> <script src="./js/custom_responsive.js"></script> <link href="./css/custom.css" rel="stylesheet" type="text/css"> <link href="./css/custom_responsive.css" rel="stylesheet" type="text/css"> </head> <body> .. .. </body> • Keep CSS at Top • Keep JavaScripts at the Bottom • Drop all inline styles if possible and don't use browser specific CSS effects (esp. IE) • Use <link> to include stylesheets - @import MUST preceded all other rules - @import may cause blank white screen phenomenon (in IE)
  • 9. CIGNEX Datamatics Confidential www.cignex.com • CSS Sprites: Combine N icons into 1 bigger image. – Reduce N requests into 1 requrest. – Be careful of the arrangement of the icons – Tool: http://www.tw.spritegen.website-performance.org/ http://csssprites.com/ • Minimize, cut snip, chop – Minimize DOM elements. Slows donw JS – Iframes are heavy and block onload event – Minimize 3rd party script. See if you load those asynchronously – Reduce the cookie size. – Optimize images, use PNG instead of GIF. – Using appropriate image format and remove redundant chunks in the image files. – PNG8 (256 color) is a good choice. – Reduce JPG quality. Tools like jpgtran, pngcrush, optipng will help – Avoid image scaling 9 Make Fewer Requests
  • 10. CIGNEX Datamatics Confidential www.cignex.com – Use JSON in AJAX requests – Use GET in Ajax requests – Prefer CSS over JSON – Font optimizing – Lazy load for Images – Avoid Flash files – Mobile-specific optimisations Make Fewer Requests ( Minimize, cut snip, chop...)
  • 11. CIGNEX Datamatics Confidential www.cignex.com Browser-Based Tools
  • 12. CIGNEX Datamatics Confidential www.cignex.com YSlow (Add-on) http://developer.yahoo.com/yslow/ • YSlow analyzes web page performance by examining all the components on the page, including components dynamically created by using JavaScript. It measures the page's performance and offers suggestions for improvement.
  • 13. CIGNEX Datamatics Confidential www.cignex.com Page Speed • Useful to detect our website performance • Gives two scores: desktop and mobile • LIsts everything we can improve https://developers.google.com/speed/pagespeed/?csw=1 Firefox Add-on
  • 14. CIGNEX Datamatics Confidential www.cignex.com Other tools • FireBug (Net tab) • Firecookie (Firecookie is an extension for Firebug that makes possible to view and manage cookies in your browser) • Live HTTP Headers (View HTTP headers of a page and while browsing.) • Chrome, Safari, IE developer tools
  • 15. CIGNEX Datamatics Confidential www.cignex.com List of best practices
  • 16. CIGNEX Datamatics Confidential www.cignex.com Simplifying CSS Selectors • CSS selector policy: Rightmost-First • Tips: – Avoid * selector – Don’t qualify ID/CSS selectors – Specific rules – Avoid descendant selectors – Avoid Tag > Child selectors – Rely on Inheritance
  • 17. CIGNEX Datamatics Confidential www.cignex.com  http://developer.yahoo.com/performance/rules.html - Yahoo  http://developer.mozilla.org/en/docs/Writing_Efficient_CSS - CSS Guidelines  http://www.alistapart.com/articles/sprites - CSS Sprites  http://www.javascripttoolbox.com/bestpractices/ - Javascript best practices  http://www.getfirebug.com/ - FireBug  http://www.julienlecomte.net/ - A nice blog  http://stevesouders.com/cuzillion/ - Place scripts & other resources tester  http://quirksmode.org/  Other references: Jquery, GWT, YUI, Ajaxian  Future - Ajax tied up with desktop web, other gadgets.  Douglaus crockford - Yahoo videos about Javascript, DOM, Advanced JS  Google I/O videos about web site performance tuning. Referances