SlideShare une entreprise Scribd logo
1  sur  35
M. Waseem Asif
AG Tech Session 28th June 2012
@folio_3 www.folio3.com Copyright 2015
 Optimizing the client side delivery of web
resources
 Performance areas
◦ Generation time (10% to 20%)
◦ Delivery time (80% to 90%)
 Why it is important
◦ Faster = Better
◦ Faster = Happy Customers
◦ Happy customers = More revenue
◦ Google effect = More traffic
www.folio3.com Copyright 2015@folio_3
Generation
Time
Delivery Time
www.folio3.com Copyright 2015@folio_3
Generation
(50%)
Delivery
(50%)
100%
Database, Cache, Code,
Web server, sphinx
CDN, Compression,
Browser Cache, HTTP
Requests, blocking calls
etc
www.folio3.com Copyright 2015@folio_3
 Reduce HTTP requests
 Use browser cache properly
 Compress content With GZIP
 Minimize JS, CSS and HTML
 http://www.infotales.com/web-application-performance/
www.folio3.com Copyright 2015@folio_3
 HTTP requests are complicated
 Involve too many players
◦ Client, proxy, ISP, routers, servers etc
 Use Sprites
◦ More efforts in design & integration
 Combine Files
 CSS3 can help
◦ Rounded corners, gradients and more
 Over Doing Can Kill UX!!!
www.folio3.com Copyright 2015@folio_3
 If cached properly, resources are not
downloaded on next requests
 Set “expires” header for static resources
 “304 Not Modified” requests
◦ Involves http round trip but file is not downloaded
www.folio3.com Copyright 2015@folio_3
 90% traffic goes through browsers that
support GZIP compression
 Reduces file size dramatically
◦ CSS, JS, HTML and Text based files
◦ Not effective for images, PDF etc
◦ Need server resource
www.folio3.com Copyright 2015@folio_3
 Using “min” versions reduce file sizes
 Compressors
◦ Remove empty lines
◦ Remove spaces
◦ Optimize tags and variables etc
 jQuery size = 256K, Min = 92K
 Many tools available
◦ CssCompressor.com
◦ JS Minifier
◦ JSCompress.com
◦ And more …
www.folio3.com Copyright 2015@folio_3
 Avoid Blocking Calls
 Page Flushing
 Use “Lazy” Loading
 “Perceived” Performance
 Don’t let 3rd Parties Slow You Down
 CSS3 and HTML 5
 Time of Interactivity
www.folio3.com Copyright 2015@folio_3
 JavaScript calls
◦ Resources in the page are blocked
◦ Elements are blocked from rendering
 Rendering is blocked unless CSS is loaded
◦ Blocked rendering means blank page
◦ Put CSS in Header
◦ Keep it small and minimized
www.folio3.com Copyright 2015@folio_3
Blocking Call
www.folio3.com Copyright 2015@folio_3
 How to avoid:
◦ aSync Loading
◦ Load bootstrap file first and then rest of the files
◦ Use “defer” tag
◦ Don’t use document.write to load scripts
var a = document.createElement("script");
a.async = true;
a.src = "http://example.com/a.js";
var s0 = document.getElementsByTagName('script')[0];
s0.parentNode.insertBefore(a, s0);
<script src="demo_defer.js" defer="defer"></script>
<script defer="defer"> //some code </script>
www.folio3.com Copyright 2015@folio_3
 Getting data out to the browser fast
 Browser is idle unless it gets data
 Flushing after <head> ensures CSS/JS starts
to download
 The browser won't render a block-level
element inside of <body> until the closing
tag has been received
www.folio3.com Copyright 2015@folio_3
<html>
<head><!-- css, js etc --></head>
<body>
<div id="doc">
<div id=“hd”>Page Header</div>
<!-- flushing here does nothing -->
<?php flush(); ?>
<div id=”bd”>BODY OF THE PAGE</div>
</div>
</body>
</html>
www.folio3.com Copyright 2015@folio_3
<html>
<head><!-- css, js etc --></head>
<!-- flushing here causes the <head> to render -->
<?php flush(); ?>
<body>
<div id="hd“>Page Header</div>
<!-- flushing here causes the “hd” div to render -->
<?php flush(); ?>
<div id=”bd”>Content of page</div>
<!-- flushing here causes the “bd” div to render -->
<?php flush(); ?>
<div id=”footer”>Page Footer</div>
</body></html>
www.folio3.com Copyright 2015@folio_3
www.folio3.com Copyright 2015@folio_3
www.folio3.com Copyright 2015@folio_3
www.folio3.com Copyright 2015@folio_3
Don't
underestimate
the power
of perception
www.folio3.com Copyright 2015@folio_3
Blank space doesn’t look good.
Make it seems like nothing is happening
www.folio3.com Copyright 2015@folio_3
 Initially the Yahoo! new page was slower to
load than the previous page
◦ A lot of CSS/JS was added
 Progressive rendering avoid blank spaces.
 Decrease time to interactivity
 Preload the Spinners
 JavaScript at the bottom
◦ Ensures it doesn't block rendering
www.folio3.com Copyright 2015@folio_3
www.folio3.com Copyright 2015@folio_3
www.folio3.com Copyright 2015@folio_3
 In the end, user testing showed that
perceived performance of the new page was
same as of the old page
www.folio3.com Copyright 2015@folio_3
 Time between the initial page request and
when the user can complete an action
 Links work. Forms can be submitted even
while the page is loading
 Not relying on JS for everything provides an
opportunity to deliver what appears to be a
faster experience
www.folio3.com Copyright 2015@folio_3
 Response time
◦ Amazon Web Services (432ms)
◦ Twitter (832ms)
◦ Facebook (918ms)
◦ PayPal (1.788s)
 How to avoid
◦ Non Blocking Call
 Move to iframe
◦ Asynchronous loading
◦ Deferral / On Demand render
 TerchCrunch.com
◦ Just say no!
www.folio3.com Copyright 2015@folio_3
 Modern browsers support many new features.
◦ Rounded Corners
◦ Gradients
◦ Fancy Borders
◦ Some more stuff
◦ UTF-8 Can help
◦ zocial.smcllns.com
 HTML 5 can help reduce html size
◦ developers.google.com/speed/articles/html5-performance
 A lot of new HTML5 features
www.folio3.com Copyright 2015@folio_3
 CDN can help
 Does not return a lot of html in JSON
◦ JSON parsing of HTML is slow
 SPDY by Google
◦ Chrome & FF Support SPDY
 Always specify image dimensions
◦ Helps in rendering
 Cacheable Ajax can help
 Avoid empty image src <img src=“”>
www.folio3.com Copyright 2015@folio_3
 Compress images PNG, WebP by Google
 Use GET for AJAX Requests
 Use HTTPS only where necessary.
 Don’t server same files from different URLs
 JSON vs. XML in AJAX
 Local Storage
 HTTP Push Techniques
 Automated solutions for performance.
www.folio3.com Copyright 2015@folio_3
 Google Analytics Site Speed
 Google Webmaster Tools
 PageSpeed from Google
 YSlow from Yahoo!
 WebPageTest.org
◦ Remote location testing
◦ Number of locations available
◦ Can help identify gaps
 PingDom.com
www.folio3.com Copyright 2015@folio_3
 How to use "flush" in template engines?
◦ Well, this needs to be found out. Some frameworks like
CI provides ability to render template without buffer.
This feature might be used.
 What does 'Defer' do?
◦ It delays execution of scripts until the body content is
parsed and rendered. For more details see
http://www.websiteoptimization.com/speed/tweak/defe
r/
 What is difference between 'Defer' and 'Async'
technique?
◦ It’s almost identical. See http://www.sitepoint.com/non-
blocking-async-defer/ for details
www.folio3.com Copyright 2015@folio_3
 What is the disadvantage of POST in Ajax calls?
◦ POST is implemented in the browsers as a two-step
process: sending the headers first, then sending the
data. So it's best to use GET, which only takes one TCP
packet to send (unless you have a lot of cookies). The
maximum URL length in IE is 2K, so if you send more
than 2K data you might not be able to use GET. See
http://developer.yahoo.com/performance/rules.html#aj
ax_get for details.
 What to put in image source, if we want to leave
it blank?
◦ Refer to
http://developer.yahoo.com/performance/rules.html#aj
ax_get for details.
www.folio3.com Copyright 2015@folio_3
 Any disadvantage of excessive flushing?
◦ Excessive usage of anything cannot guarantee good
performance. Thus should be used in a balanced
manner. However I don't know any particular
disadvantages at the moment.
 Does custom attributes affect page
rendering?
◦ It should not, but can't be assured.
 DOM manipulation Vs InnerHTML?
◦ DOM manipulations are heavier than InnerHtml. See
http://andrew.hedges.name/experiments/innerhtm
l/ for details.
www.folio3.com Copyright 2015@folio_3
 WebPerformanceToday.com
 Yahoo! Case study
◦ http://velocityconf.com/velocity2010/public/sched
ule/detail/11802
 Best practices
◦ https://developers.google.com/speed/docs/best-
practices/rules_intro
◦ http://developer.yahoo.com/performance/rules.ht
ml
 SteveSouders.com
◦ http://stevesouders.com/cuzillion/?ex=10008&title
=Scripts+Block+Downloads
www.folio3.com Copyright 2015@folio_3

Contenu connexe

Tendances

Secure web messaging in HTML5
Secure web messaging in HTML5Secure web messaging in HTML5
Secure web messaging in HTML5
Krishna T
 
Introduction to Web Development Career
Introduction to Web Development CareerIntroduction to Web Development Career
Introduction to Web Development Career
Eunus Hosen
 

Tendances (20)

Html5 Fit: Get Rid of Love Handles
Html5 Fit:  Get Rid of Love HandlesHtml5 Fit:  Get Rid of Love Handles
Html5 Fit: Get Rid of Love Handles
 
How to investigate and recover from a security breach in WordPress
How to investigate and recover from a security breach in WordPressHow to investigate and recover from a security breach in WordPress
How to investigate and recover from a security breach in WordPress
 
Html5 security
Html5 securityHtml5 security
Html5 security
 
Secure web messaging in HTML5
Secure web messaging in HTML5Secure web messaging in HTML5
Secure web messaging in HTML5
 
Cross-Browser Compatibility, and a little bit about Page Load, too.
Cross-Browser Compatibility, and a little bit about Page Load, too.Cross-Browser Compatibility, and a little bit about Page Load, too.
Cross-Browser Compatibility, and a little bit about Page Load, too.
 
Time is the enemy
Time is the enemyTime is the enemy
Time is the enemy
 
HTTPS and HTTP/2
HTTPS and HTTP/2HTTPS and HTTP/2
HTTPS and HTTP/2
 
Does This Theme Make My Website Look Fat? (Wordcamp SLC 2013)
Does This Theme Make My Website Look Fat? (Wordcamp SLC 2013)Does This Theme Make My Website Look Fat? (Wordcamp SLC 2013)
Does This Theme Make My Website Look Fat? (Wordcamp SLC 2013)
 
Web20expo 20080425
Web20expo 20080425Web20expo 20080425
Web20expo 20080425
 
Spreadshirt Techcamp 2018 - Hold until Told
Spreadshirt Techcamp 2018 - Hold until ToldSpreadshirt Techcamp 2018 - Hold until Told
Spreadshirt Techcamp 2018 - Hold until Told
 
Cache is King
Cache is KingCache is King
Cache is King
 
Frontend SPOF
Frontend SPOFFrontend SPOF
Frontend SPOF
 
Speed Index, explained!
Speed Index, explained!Speed Index, explained!
Speed Index, explained!
 
Building High Performance Websites - Session-1
Building High Performance Websites - Session-1Building High Performance Websites - Session-1
Building High Performance Websites - Session-1
 
Introduction to Web Development Career
Introduction to Web Development CareerIntroduction to Web Development Career
Introduction to Web Development Career
 
8 Simple Ways to Hack Your Joomla
8 Simple Ways to Hack Your Joomla8 Simple Ways to Hack Your Joomla
8 Simple Ways to Hack Your Joomla
 
The 5 most common reasons for a slow WordPress site and how to fix them
The 5 most common reasons for a slow WordPress site and how to fix themThe 5 most common reasons for a slow WordPress site and how to fix them
The 5 most common reasons for a slow WordPress site and how to fix them
 
8 Most Popular Joomla Hacks & How To Avoid Them
8 Most Popular Joomla Hacks & How To Avoid Them8 Most Popular Joomla Hacks & How To Avoid Them
8 Most Popular Joomla Hacks & How To Avoid Them
 
Secrets to a Hack-Proof Joomla Revealed
Secrets to a Hack-Proof Joomla RevealedSecrets to a Hack-Proof Joomla Revealed
Secrets to a Hack-Proof Joomla Revealed
 
Caching All The Things
Caching All The ThingsCaching All The Things
Caching All The Things
 

En vedette

En vedette (16)

Web Performance & Scalability Tools
Web Performance & Scalability ToolsWeb Performance & Scalability Tools
Web Performance & Scalability Tools
 
Offline Data Access in Enterprise Mobility
Offline Data Access in Enterprise MobilityOffline Data Access in Enterprise Mobility
Offline Data Access in Enterprise Mobility
 
Dimensional Modelling - Basic Concept
Dimensional Modelling - Basic ConceptDimensional Modelling - Basic Concept
Dimensional Modelling - Basic Concept
 
Web Application Security - Folio3
Web Application Security - Folio3Web Application Security - Folio3
Web Application Security - Folio3
 
An Overview of Blackberry 10 & Blackberry App Development
An Overview of Blackberry 10 & Blackberry App DevelopmentAn Overview of Blackberry 10 & Blackberry App Development
An Overview of Blackberry 10 & Blackberry App Development
 
Cache is king
Cache is kingCache is king
Cache is king
 
Introduction to Docker
Introduction to DockerIntroduction to Docker
Introduction to Docker
 
Distributed and Fault Tolerant Realtime Computation with Apache Storm, Apache...
Distributed and Fault Tolerant Realtime Computation with Apache Storm, Apache...Distributed and Fault Tolerant Realtime Computation with Apache Storm, Apache...
Distributed and Fault Tolerant Realtime Computation with Apache Storm, Apache...
 
An Introduction to CSS Preprocessors (SASS & LESS)
An Introduction to CSS Preprocessors (SASS & LESS)An Introduction to CSS Preprocessors (SASS & LESS)
An Introduction to CSS Preprocessors (SASS & LESS)
 
An Overview of Blackberry 10
An Overview of Blackberry 10An Overview of Blackberry 10
An Overview of Blackberry 10
 
Introduction to SharePoint 2013
Introduction to SharePoint 2013Introduction to SharePoint 2013
Introduction to SharePoint 2013
 
Cross Platform Mobile App Development - An Introduction to Sencha Touch
Cross Platform Mobile App Development - An Introduction to Sencha TouchCross Platform Mobile App Development - An Introduction to Sencha Touch
Cross Platform Mobile App Development - An Introduction to Sencha Touch
 
Enterprise Mobility - An Introduction
Enterprise Mobility - An IntroductionEnterprise Mobility - An Introduction
Enterprise Mobility - An Introduction
 
Introduction to Go-Lang
Introduction to Go-LangIntroduction to Go-Lang
Introduction to Go-Lang
 
Best Practices of Software Development
Best Practices of Software DevelopmentBest Practices of Software Development
Best Practices of Software Development
 
NOSQL Database: Apache Cassandra
NOSQL Database: Apache CassandraNOSQL Database: Apache Cassandra
NOSQL Database: Apache Cassandra
 

Similaire à Front End Oprtimization

@media - Even Faster Web Sites
@media - Even Faster Web Sites@media - Even Faster Web Sites
@media - Even Faster Web Sites
Steve Souders
 
High Performance Mobile (SF/SV Web Perf)
High Performance Mobile (SF/SV Web Perf)High Performance Mobile (SF/SV Web Perf)
High Performance Mobile (SF/SV Web Perf)
Steve Souders
 
Optimising Web Application Frontend
Optimising Web Application FrontendOptimising Web Application Frontend
Optimising Web Application Frontend
tkramar
 
Website Performance
Website PerformanceWebsite Performance
Website Performance
Hugo Fonseca
 

Similaire à Front End Oprtimization (20)

WebSocket Perspectives and Vision for the Future
WebSocket Perspectives and Vision for the FutureWebSocket Perspectives and Vision for the Future
WebSocket Perspectives and Vision for the Future
 
High Performance Websites
High Performance WebsitesHigh Performance Websites
High Performance Websites
 
High-Speed HTML5
High-Speed HTML5High-Speed HTML5
High-Speed HTML5
 
Optimizing your WordPress website
Optimizing your WordPress websiteOptimizing your WordPress website
Optimizing your WordPress website
 
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
 
IEEE KUET SPAC presentation
IEEE KUET SPAC  presentationIEEE KUET SPAC  presentation
IEEE KUET SPAC presentation
 
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
 
@media - Even Faster Web Sites
@media - Even Faster Web Sites@media - Even Faster Web Sites
@media - Even Faster Web Sites
 
High Performance Ajax Applications
High Performance Ajax ApplicationsHigh Performance Ajax Applications
High Performance Ajax Applications
 
High Performance Mobile (SF/SV Web Perf)
High Performance Mobile (SF/SV Web Perf)High Performance Mobile (SF/SV Web Perf)
High Performance Mobile (SF/SV Web Perf)
 
Testable client side_mvc_apps_in_javascript
Testable client side_mvc_apps_in_javascriptTestable client side_mvc_apps_in_javascript
Testable client side_mvc_apps_in_javascript
 
Web Performance Optimization
Web Performance OptimizationWeb Performance Optimization
Web Performance Optimization
 
Optimising Web Application Frontend
Optimising Web Application FrontendOptimising Web Application Frontend
Optimising Web Application Frontend
 
Developing High Performance Web Apps
Developing High Performance Web AppsDeveloping High Performance Web Apps
Developing High Performance Web Apps
 
Caching & Performance In Cold Fusion
Caching & Performance In Cold FusionCaching & Performance In Cold Fusion
Caching & Performance In Cold Fusion
 
Client Side Performance @ Xero
Client Side Performance @ XeroClient Side Performance @ Xero
Client Side Performance @ Xero
 
Website Performance
Website PerformanceWebsite Performance
Website Performance
 
5 critical-optimizations.v2
5 critical-optimizations.v25 critical-optimizations.v2
5 critical-optimizations.v2
 
Developing JavaScript Widgets
Developing JavaScript WidgetsDeveloping JavaScript Widgets
Developing JavaScript Widgets
 
Dave Orchard - Offline Web Apps with HTML5
Dave Orchard - Offline Web Apps with HTML5Dave Orchard - Offline Web Apps with HTML5
Dave Orchard - Offline Web Apps with HTML5
 

Plus de Folio3 Software

Plus de Folio3 Software (14)

Shopify & Shopify Plus Ecommerce Development Experts
Shopify & Shopify Plus Ecommerce Development Experts Shopify & Shopify Plus Ecommerce Development Experts
Shopify & Shopify Plus Ecommerce Development Experts
 
Magento and Magento 2 Ecommerce Development
Magento and Magento 2 Ecommerce Development Magento and Magento 2 Ecommerce Development
Magento and Magento 2 Ecommerce Development
 
All You Need to Know About Type Script
All You Need to Know About Type ScriptAll You Need to Know About Type Script
All You Need to Know About Type Script
 
Enter the Big Picture
Enter the Big PictureEnter the Big Picture
Enter the Big Picture
 
A Guideline to Test Your Own Code - Developer Testing
A Guideline to Test Your Own Code - Developer TestingA Guideline to Test Your Own Code - Developer Testing
A Guideline to Test Your Own Code - Developer Testing
 
OWIN (Open Web Interface for .NET)
OWIN (Open Web Interface for .NET)OWIN (Open Web Interface for .NET)
OWIN (Open Web Interface for .NET)
 
StackOverflow Architectural Overview
StackOverflow Architectural OverviewStackOverflow Architectural Overview
StackOverflow Architectural Overview
 
Introduction to Enterprise Service Bus
Introduction to Enterprise Service BusIntroduction to Enterprise Service Bus
Introduction to Enterprise Service Bus
 
Regular Expression in Action
Regular Expression in ActionRegular Expression in Action
Regular Expression in Action
 
HTTP Server Push Techniques
HTTP Server Push TechniquesHTTP Server Push Techniques
HTTP Server Push Techniques
 
Realtime and Synchronous Applications
Realtime and Synchronous ApplicationsRealtime and Synchronous Applications
Realtime and Synchronous Applications
 
Andriod - Technical Review
Andriod - Technical ReviewAndriod - Technical Review
Andriod - Technical Review
 
NetSuite Integration Solutions - Folio3
NetSuite Integration Solutions - Folio3NetSuite Integration Solutions - Folio3
NetSuite Integration Solutions - Folio3
 
Folio3 - An Introduction to PHP Yii
Folio3 - An Introduction to PHP YiiFolio3 - An Introduction to PHP Yii
Folio3 - An Introduction to PHP Yii
 

Dernier

Top profile Call Girls In Sonipat [ 7014168258 ] Call Me For Genuine Models W...
Top profile Call Girls In Sonipat [ 7014168258 ] Call Me For Genuine Models W...Top profile Call Girls In Sonipat [ 7014168258 ] Call Me For Genuine Models W...
Top profile Call Girls In Sonipat [ 7014168258 ] Call Me For Genuine Models W...
nirzagarg
 
一比一定(购)西悉尼大学毕业证(WSU毕业证)成绩单学位证
一比一定(购)西悉尼大学毕业证(WSU毕业证)成绩单学位证一比一定(购)西悉尼大学毕业证(WSU毕业证)成绩单学位证
一比一定(购)西悉尼大学毕业证(WSU毕业证)成绩单学位证
eqaqen
 
How to Build a Simple Shopify Website
How to Build a Simple Shopify WebsiteHow to Build a Simple Shopify Website
How to Build a Simple Shopify Website
mark11275
 
Abortion Pills in Oman (+918133066128) Cytotec clinic buy Oman Muscat
Abortion Pills in Oman (+918133066128) Cytotec clinic buy Oman MuscatAbortion Pills in Oman (+918133066128) Cytotec clinic buy Oman Muscat
Abortion Pills in Oman (+918133066128) Cytotec clinic buy Oman Muscat
Abortion pills in Kuwait Cytotec pills in Kuwait
 
Anupama Kundoo Cost Effective detailed ppt with plans and elevations with det...
Anupama Kundoo Cost Effective detailed ppt with plans and elevations with det...Anupama Kundoo Cost Effective detailed ppt with plans and elevations with det...
Anupama Kundoo Cost Effective detailed ppt with plans and elevations with det...
sriharipichandi
 
Q4-Trends-Networks-Module-3.pdfqquater days sheets123456789
Q4-Trends-Networks-Module-3.pdfqquater days sheets123456789Q4-Trends-Networks-Module-3.pdfqquater days sheets123456789
Q4-Trends-Networks-Module-3.pdfqquater days sheets123456789
CristineGraceAcuyan
 
一比一原版(WLU毕业证)罗瑞尔大学毕业证成绩单留信学历认证原版一模一样
一比一原版(WLU毕业证)罗瑞尔大学毕业证成绩单留信学历认证原版一模一样一比一原版(WLU毕业证)罗瑞尔大学毕业证成绩单留信学历认证原版一模一样
一比一原版(WLU毕业证)罗瑞尔大学毕业证成绩单留信学历认证原版一模一样
awasv46j
 
Minimalist Orange Portfolio by Slidesgo.pptx
Minimalist Orange Portfolio by Slidesgo.pptxMinimalist Orange Portfolio by Slidesgo.pptx
Minimalist Orange Portfolio by Slidesgo.pptx
balqisyamutia
 
Top profile Call Girls In eluru [ 7014168258 ] Call Me For Genuine Models We ...
Top profile Call Girls In eluru [ 7014168258 ] Call Me For Genuine Models We ...Top profile Call Girls In eluru [ 7014168258 ] Call Me For Genuine Models We ...
Top profile Call Girls In eluru [ 7014168258 ] Call Me For Genuine Models We ...
gajnagarg
 
Madhyamgram \ (Genuine) Escort Service Kolkata | Service-oriented sexy call g...
Madhyamgram \ (Genuine) Escort Service Kolkata | Service-oriented sexy call g...Madhyamgram \ (Genuine) Escort Service Kolkata | Service-oriented sexy call g...
Madhyamgram \ (Genuine) Escort Service Kolkata | Service-oriented sexy call g...
HyderabadDolls
 
Call Girls In Ratnagiri Escorts ☎️8617370543 🔝 💃 Enjoy 24/7 Escort Service En...
Call Girls In Ratnagiri Escorts ☎️8617370543 🔝 💃 Enjoy 24/7 Escort Service En...Call Girls In Ratnagiri Escorts ☎️8617370543 🔝 💃 Enjoy 24/7 Escort Service En...
Call Girls In Ratnagiri Escorts ☎️8617370543 🔝 💃 Enjoy 24/7 Escort Service En...
Nitya salvi
 

Dernier (20)

Furniture & Joinery Details_Designs.pptx
Furniture & Joinery Details_Designs.pptxFurniture & Joinery Details_Designs.pptx
Furniture & Joinery Details_Designs.pptx
 
Top profile Call Girls In Sonipat [ 7014168258 ] Call Me For Genuine Models W...
Top profile Call Girls In Sonipat [ 7014168258 ] Call Me For Genuine Models W...Top profile Call Girls In Sonipat [ 7014168258 ] Call Me For Genuine Models W...
Top profile Call Girls In Sonipat [ 7014168258 ] Call Me For Genuine Models W...
 
一比一定(购)西悉尼大学毕业证(WSU毕业证)成绩单学位证
一比一定(购)西悉尼大学毕业证(WSU毕业证)成绩单学位证一比一定(购)西悉尼大学毕业证(WSU毕业证)成绩单学位证
一比一定(购)西悉尼大学毕业证(WSU毕业证)成绩单学位证
 
How to Build a Simple Shopify Website
How to Build a Simple Shopify WebsiteHow to Build a Simple Shopify Website
How to Build a Simple Shopify Website
 
Abortion Pills in Oman (+918133066128) Cytotec clinic buy Oman Muscat
Abortion Pills in Oman (+918133066128) Cytotec clinic buy Oman MuscatAbortion Pills in Oman (+918133066128) Cytotec clinic buy Oman Muscat
Abortion Pills in Oman (+918133066128) Cytotec clinic buy Oman Muscat
 
TRose UXPA Experience Design Concord .pptx
TRose UXPA Experience Design Concord .pptxTRose UXPA Experience Design Concord .pptx
TRose UXPA Experience Design Concord .pptx
 
Anupama Kundoo Cost Effective detailed ppt with plans and elevations with det...
Anupama Kundoo Cost Effective detailed ppt with plans and elevations with det...Anupama Kundoo Cost Effective detailed ppt with plans and elevations with det...
Anupama Kundoo Cost Effective detailed ppt with plans and elevations with det...
 
Just Call Vip call girls Fatehpur Escorts ☎️8617370543 Two shot with one girl...
Just Call Vip call girls Fatehpur Escorts ☎️8617370543 Two shot with one girl...Just Call Vip call girls Fatehpur Escorts ☎️8617370543 Two shot with one girl...
Just Call Vip call girls Fatehpur Escorts ☎️8617370543 Two shot with one girl...
 
Q4-Trends-Networks-Module-3.pdfqquater days sheets123456789
Q4-Trends-Networks-Module-3.pdfqquater days sheets123456789Q4-Trends-Networks-Module-3.pdfqquater days sheets123456789
Q4-Trends-Networks-Module-3.pdfqquater days sheets123456789
 
一比一原版(WLU毕业证)罗瑞尔大学毕业证成绩单留信学历认证原版一模一样
一比一原版(WLU毕业证)罗瑞尔大学毕业证成绩单留信学历认证原版一模一样一比一原版(WLU毕业证)罗瑞尔大学毕业证成绩单留信学历认证原版一模一样
一比一原版(WLU毕业证)罗瑞尔大学毕业证成绩单留信学历认证原版一模一样
 
Jordan_Amanda_DMBS202404_PB1_2024-04.pdf
Jordan_Amanda_DMBS202404_PB1_2024-04.pdfJordan_Amanda_DMBS202404_PB1_2024-04.pdf
Jordan_Amanda_DMBS202404_PB1_2024-04.pdf
 
Lecture 01 Introduction To Multimedia.pptx
Lecture 01 Introduction To Multimedia.pptxLecture 01 Introduction To Multimedia.pptx
Lecture 01 Introduction To Multimedia.pptx
 
Minimalist Orange Portfolio by Slidesgo.pptx
Minimalist Orange Portfolio by Slidesgo.pptxMinimalist Orange Portfolio by Slidesgo.pptx
Minimalist Orange Portfolio by Slidesgo.pptx
 
Independent Escorts Goregaon WhatsApp +91-9930687706, Best Service
Independent Escorts Goregaon WhatsApp +91-9930687706, Best ServiceIndependent Escorts Goregaon WhatsApp +91-9930687706, Best Service
Independent Escorts Goregaon WhatsApp +91-9930687706, Best Service
 
Top profile Call Girls In eluru [ 7014168258 ] Call Me For Genuine Models We ...
Top profile Call Girls In eluru [ 7014168258 ] Call Me For Genuine Models We ...Top profile Call Girls In eluru [ 7014168258 ] Call Me For Genuine Models We ...
Top profile Call Girls In eluru [ 7014168258 ] Call Me For Genuine Models We ...
 
Madhyamgram \ (Genuine) Escort Service Kolkata | Service-oriented sexy call g...
Madhyamgram \ (Genuine) Escort Service Kolkata | Service-oriented sexy call g...Madhyamgram \ (Genuine) Escort Service Kolkata | Service-oriented sexy call g...
Madhyamgram \ (Genuine) Escort Service Kolkata | Service-oriented sexy call g...
 
Just Call Vip call girls Kasganj Escorts ☎️8617370543 Two shot with one girl ...
Just Call Vip call girls Kasganj Escorts ☎️8617370543 Two shot with one girl ...Just Call Vip call girls Kasganj Escorts ☎️8617370543 Two shot with one girl ...
Just Call Vip call girls Kasganj Escorts ☎️8617370543 Two shot with one girl ...
 
Call Girls In Ratnagiri Escorts ☎️8617370543 🔝 💃 Enjoy 24/7 Escort Service En...
Call Girls In Ratnagiri Escorts ☎️8617370543 🔝 💃 Enjoy 24/7 Escort Service En...Call Girls In Ratnagiri Escorts ☎️8617370543 🔝 💃 Enjoy 24/7 Escort Service En...
Call Girls In Ratnagiri Escorts ☎️8617370543 🔝 💃 Enjoy 24/7 Escort Service En...
 
NO1 Top Pakistani Amil Baba Real Amil baba In Pakistan Najoomi Baba in Pakist...
NO1 Top Pakistani Amil Baba Real Amil baba In Pakistan Najoomi Baba in Pakist...NO1 Top Pakistani Amil Baba Real Amil baba In Pakistan Najoomi Baba in Pakist...
NO1 Top Pakistani Amil Baba Real Amil baba In Pakistan Najoomi Baba in Pakist...
 
UI:UX Design and Empowerment Strategies for Underprivileged Transgender Indiv...
UI:UX Design and Empowerment Strategies for Underprivileged Transgender Indiv...UI:UX Design and Empowerment Strategies for Underprivileged Transgender Indiv...
UI:UX Design and Empowerment Strategies for Underprivileged Transgender Indiv...
 

Front End Oprtimization

  • 1. M. Waseem Asif AG Tech Session 28th June 2012 @folio_3 www.folio3.com Copyright 2015
  • 2.  Optimizing the client side delivery of web resources  Performance areas ◦ Generation time (10% to 20%) ◦ Delivery time (80% to 90%)  Why it is important ◦ Faster = Better ◦ Faster = Happy Customers ◦ Happy customers = More revenue ◦ Google effect = More traffic www.folio3.com Copyright 2015@folio_3
  • 4. Generation (50%) Delivery (50%) 100% Database, Cache, Code, Web server, sphinx CDN, Compression, Browser Cache, HTTP Requests, blocking calls etc www.folio3.com Copyright 2015@folio_3
  • 5.  Reduce HTTP requests  Use browser cache properly  Compress content With GZIP  Minimize JS, CSS and HTML  http://www.infotales.com/web-application-performance/ www.folio3.com Copyright 2015@folio_3
  • 6.  HTTP requests are complicated  Involve too many players ◦ Client, proxy, ISP, routers, servers etc  Use Sprites ◦ More efforts in design & integration  Combine Files  CSS3 can help ◦ Rounded corners, gradients and more  Over Doing Can Kill UX!!! www.folio3.com Copyright 2015@folio_3
  • 7.  If cached properly, resources are not downloaded on next requests  Set “expires” header for static resources  “304 Not Modified” requests ◦ Involves http round trip but file is not downloaded www.folio3.com Copyright 2015@folio_3
  • 8.  90% traffic goes through browsers that support GZIP compression  Reduces file size dramatically ◦ CSS, JS, HTML and Text based files ◦ Not effective for images, PDF etc ◦ Need server resource www.folio3.com Copyright 2015@folio_3
  • 9.  Using “min” versions reduce file sizes  Compressors ◦ Remove empty lines ◦ Remove spaces ◦ Optimize tags and variables etc  jQuery size = 256K, Min = 92K  Many tools available ◦ CssCompressor.com ◦ JS Minifier ◦ JSCompress.com ◦ And more … www.folio3.com Copyright 2015@folio_3
  • 10.  Avoid Blocking Calls  Page Flushing  Use “Lazy” Loading  “Perceived” Performance  Don’t let 3rd Parties Slow You Down  CSS3 and HTML 5  Time of Interactivity www.folio3.com Copyright 2015@folio_3
  • 11.  JavaScript calls ◦ Resources in the page are blocked ◦ Elements are blocked from rendering  Rendering is blocked unless CSS is loaded ◦ Blocked rendering means blank page ◦ Put CSS in Header ◦ Keep it small and minimized www.folio3.com Copyright 2015@folio_3
  • 13.  How to avoid: ◦ aSync Loading ◦ Load bootstrap file first and then rest of the files ◦ Use “defer” tag ◦ Don’t use document.write to load scripts var a = document.createElement("script"); a.async = true; a.src = "http://example.com/a.js"; var s0 = document.getElementsByTagName('script')[0]; s0.parentNode.insertBefore(a, s0); <script src="demo_defer.js" defer="defer"></script> <script defer="defer"> //some code </script> www.folio3.com Copyright 2015@folio_3
  • 14.  Getting data out to the browser fast  Browser is idle unless it gets data  Flushing after <head> ensures CSS/JS starts to download  The browser won't render a block-level element inside of <body> until the closing tag has been received www.folio3.com Copyright 2015@folio_3
  • 15. <html> <head><!-- css, js etc --></head> <body> <div id="doc"> <div id=“hd”>Page Header</div> <!-- flushing here does nothing --> <?php flush(); ?> <div id=”bd”>BODY OF THE PAGE</div> </div> </body> </html> www.folio3.com Copyright 2015@folio_3
  • 16. <html> <head><!-- css, js etc --></head> <!-- flushing here causes the <head> to render --> <?php flush(); ?> <body> <div id="hd“>Page Header</div> <!-- flushing here causes the “hd” div to render --> <?php flush(); ?> <div id=”bd”>Content of page</div> <!-- flushing here causes the “bd” div to render --> <?php flush(); ?> <div id=”footer”>Page Footer</div> </body></html> www.folio3.com Copyright 2015@folio_3
  • 21. Blank space doesn’t look good. Make it seems like nothing is happening www.folio3.com Copyright 2015@folio_3
  • 22.  Initially the Yahoo! new page was slower to load than the previous page ◦ A lot of CSS/JS was added  Progressive rendering avoid blank spaces.  Decrease time to interactivity  Preload the Spinners  JavaScript at the bottom ◦ Ensures it doesn't block rendering www.folio3.com Copyright 2015@folio_3
  • 25.  In the end, user testing showed that perceived performance of the new page was same as of the old page www.folio3.com Copyright 2015@folio_3
  • 26.  Time between the initial page request and when the user can complete an action  Links work. Forms can be submitted even while the page is loading  Not relying on JS for everything provides an opportunity to deliver what appears to be a faster experience www.folio3.com Copyright 2015@folio_3
  • 27.  Response time ◦ Amazon Web Services (432ms) ◦ Twitter (832ms) ◦ Facebook (918ms) ◦ PayPal (1.788s)  How to avoid ◦ Non Blocking Call  Move to iframe ◦ Asynchronous loading ◦ Deferral / On Demand render  TerchCrunch.com ◦ Just say no! www.folio3.com Copyright 2015@folio_3
  • 28.  Modern browsers support many new features. ◦ Rounded Corners ◦ Gradients ◦ Fancy Borders ◦ Some more stuff ◦ UTF-8 Can help ◦ zocial.smcllns.com  HTML 5 can help reduce html size ◦ developers.google.com/speed/articles/html5-performance  A lot of new HTML5 features www.folio3.com Copyright 2015@folio_3
  • 29.  CDN can help  Does not return a lot of html in JSON ◦ JSON parsing of HTML is slow  SPDY by Google ◦ Chrome & FF Support SPDY  Always specify image dimensions ◦ Helps in rendering  Cacheable Ajax can help  Avoid empty image src <img src=“”> www.folio3.com Copyright 2015@folio_3
  • 30.  Compress images PNG, WebP by Google  Use GET for AJAX Requests  Use HTTPS only where necessary.  Don’t server same files from different URLs  JSON vs. XML in AJAX  Local Storage  HTTP Push Techniques  Automated solutions for performance. www.folio3.com Copyright 2015@folio_3
  • 31.  Google Analytics Site Speed  Google Webmaster Tools  PageSpeed from Google  YSlow from Yahoo!  WebPageTest.org ◦ Remote location testing ◦ Number of locations available ◦ Can help identify gaps  PingDom.com www.folio3.com Copyright 2015@folio_3
  • 32.  How to use "flush" in template engines? ◦ Well, this needs to be found out. Some frameworks like CI provides ability to render template without buffer. This feature might be used.  What does 'Defer' do? ◦ It delays execution of scripts until the body content is parsed and rendered. For more details see http://www.websiteoptimization.com/speed/tweak/defe r/  What is difference between 'Defer' and 'Async' technique? ◦ It’s almost identical. See http://www.sitepoint.com/non- blocking-async-defer/ for details www.folio3.com Copyright 2015@folio_3
  • 33.  What is the disadvantage of POST in Ajax calls? ◦ POST is implemented in the browsers as a two-step process: sending the headers first, then sending the data. So it's best to use GET, which only takes one TCP packet to send (unless you have a lot of cookies). The maximum URL length in IE is 2K, so if you send more than 2K data you might not be able to use GET. See http://developer.yahoo.com/performance/rules.html#aj ax_get for details.  What to put in image source, if we want to leave it blank? ◦ Refer to http://developer.yahoo.com/performance/rules.html#aj ax_get for details. www.folio3.com Copyright 2015@folio_3
  • 34.  Any disadvantage of excessive flushing? ◦ Excessive usage of anything cannot guarantee good performance. Thus should be used in a balanced manner. However I don't know any particular disadvantages at the moment.  Does custom attributes affect page rendering? ◦ It should not, but can't be assured.  DOM manipulation Vs InnerHTML? ◦ DOM manipulations are heavier than InnerHtml. See http://andrew.hedges.name/experiments/innerhtm l/ for details. www.folio3.com Copyright 2015@folio_3
  • 35.  WebPerformanceToday.com  Yahoo! Case study ◦ http://velocityconf.com/velocity2010/public/sched ule/detail/11802  Best practices ◦ https://developers.google.com/speed/docs/best- practices/rules_intro ◦ http://developer.yahoo.com/performance/rules.ht ml  SteveSouders.com ◦ http://stevesouders.com/cuzillion/?ex=10008&title =Scripts+Block+Downloads www.folio3.com Copyright 2015@folio_3

Notes de l'éditeur

  1. Google effect : Google starts giving weight to performance Happy customers : e.g Gmail. Google.com Twitter.com
  2. Generation Time Delivery Time [ Latency ]
  3. Database [ DB engine, Indexes , Query optimization ] Cache [ Memcahe, Opcode, Sphinx] Code [JS size,Image size, ] Web server [ hardware, tuning ]