SlideShare a Scribd company logo
Performance optimization
ID meeting
13 th January 2010

Filip Mares
Agenda
•Why Optimise Front-End?
•Importance of performance
•34 best practices
•Optimize CSS for faster browser rendering
•Write efficient CSS
•Minify CSS
Why Optimise Front-End?
• More potential for improvement
• Typically require less time = lower costs
• It’s proven to work
Importance of performance
• Better user experience
• More traffic
+0.4s = 5-9% drop in full-page traffic (Yahoo!)
• More revenue
+1sec = 2.8% drop in revenue
• Reduced costs
HW costs, bandwidth costs
Make it right
before you make it fast
34 best practices (by YDN)
1. Make fewer HTTP Requests

18. Preload Components

2. Use a Content Delivery Network

19. Reduce the Number of DOM Elements

3. Add an Expires or a Cache-Control Header

20. Split Components Across Domains

4. Gzip Components

21. Minimize the Number of iframes

5. Put Style sheets at the Top

22. No 404s

6. Put Scripts at the Bottom

23. Reduce Cookie Size

7. Avoid CSS Expressions

24. Use Cookie-free Domains for Components

8. Make JavaScript and CSS External

25. Minimize DOM Access

9. Reduce DNS Lookups

26. Develop Smart Event Handlers

10. Minify JavaScript and CSS

27. Choose <link> over @import

11. Avoid Redirects

28. Avoid Filters

12. Remove Duplicate JS and CSS

29. Optimize Images

13. Configure ETags

30. Optimize CSS Sprites

14. Make Ajax Cacheable

31. Don’t Scale Images in HTML

15. Flush the Buffer Early

32. Make favicon.ico Small and Cacheable

16. Use GET for Ajax Requests

33. Keep Components under 25K

17. Post-load Components

34. Pack Components into a Multipart Document
23 best practices for IDs
1. Make fewer HTTP Requests

18. Preload Components

2. Use a Content Delivery Network

19. Reduce the Number of DOM Elements

3. Add an Expires or a Cache-Control Header

20. Split Components Across Domains

4. Gzip Components

21. Minimize the Number of iframes

5. Put Style sheets at the Top

22. No 404s

6. Put Scripts at the Bottom

23. Reduce Cookie Size

7. Avoid CSS Expressions

24. Use Cookie-free Domains for Components

8. Make JavaScript and CSS External

25. Minimize DOM Access

9. Reduce DNS Lookups

26. Develop Smart Event Handlers

10. Minify JavaScript and CSS

27. Choose <link> over @import

11. Avoid Redirects

28. Avoid Filters

12. Remove Duplicate JS and CSS

29. Optimize Images

13. Configure ETags

30. Optimize CSS Sprites

14. Make Ajax Cacheable

31. Don’t Scale Images in HTML

15. Flush the Buffer Early

32. Make favicon.ico Small and Cacheable

16. Use GET for Ajax Requests

33. Keep Components under 25K

17. Post-load Components

34. Pack Components into a Multipart Document
Optimize CSS
for faster browser rendering
Less HTTP requests
• Combine CSS files
No separate print CSS
• Inline images with data
background‐image: url("data:image/png;base64,iVBORw0KG...");
• Lazy-load stylesheets used by JavaScript
CSS files on demand
Less HTTP requests - drawback
•Bigger files or more combinations to cache
•Not as nice as atomic components
•Inline images does not work in IE up to IE7
•Hard to make even small changes
•Need of new filename when the „never expire“ policy is on
Other CSS optimization practices
•Put CSS in the document head
•Make CSS External
•Choose <link> over @import
•Avoid Filters
•Avoid CSS expressions
•Specify image dimensions
Write efficient CSS
Descendants and child
selectors can affect
performance, but don’t
worry about them so much
as to not use them.
Efficient CSS practices
•Group selectors with common declarations

•Use CSS shorthand

#nav {text-align: center}
#main{text-align: center}
#nav, #main{text-align: center}

#nav {margin:2em 1em 3em 1em; padding: 0em;
color:#ffcc00}
#nav {margin:2em 1em 3em; padding: 0; color:#fc0}

•Group declarations with common selectors

•Abbreviate long class and ID names

#nav {text-align: center}
#nav {color:#eee}
#nav {text-align: center; color:#eee}

•Combine common styles into shared classes
•Keep the cascade in mind
•Use inheritance to eliminate duplicate
declarations
•Remove unused CSS

•Make rules as specific as possible
•Avoid universal rules
•Remove redundant qualifiers
•Avoid descendant selectors, especially those
that specify redundant ancestors
•Avoid the :hover pseudo-selector for non-link
elements for IE clients
Inefficient rules
•Rules with descendant selectors
body *
ul li a
•Rules with child or adjacent selectors
body > *
ul > li > a
•Rules with overly qualified selectors
form#UserLogin
•Rules that apply the :hover pseudo-selector to non-link elements
h3:hover
Minify CSS
Tested tools
•Clean CSS
•CSS Optimiser
•Icey CSS Compressor
•YUI Compressor
•flumpCakes Optimiser
Tested tools - results
Tool Used

File Size

Lines

compression ratio:

None

12,875

227

Original

Clean CSS

11,735

940

9%

CSS Optimiser

11,304

2

12%

Icey CSS Compressor

10,383

1

19%

YUI Compressor

11,175

1

13%

796

0%

Flumpcakes Optimiser 12,885
Questions?
Thanks
for listening
Links
•Best Practices for Speeding Up Your Web Site
http://developer.yahoo.com/performance/rules.html

•Testing CSS Performance
http://blog.archive.jpsykes.com/151/testing-css-performance/

•Performance Impact of CSS Selectors
http://www.stevesouders.com/blog/2009/03/10/performance-impact-of-css-selectors/

•Optimize browser rendering
http://code.google.com/speed/page-speed/docs/rendering.html

•CSS Optimization: Make Your Sites Load Faster for Free
http://www.bloggingpro.com/archives/2006/08/17/css-optimization/

More Related Content

What's hot (20)

PDF
Performance Testing w/ WebPage Test Private Instance (DrupalCamp Ohio)
Bill Condo
 
PPTX
The server side story: Parallel and Asynchronous programming in .NET - ITPro...
Panagiotis Kanavos
 
PPTX
Getting Started with Web Services
DataNext Solutions
 
PPTX
Silverstripe at scale - design & architecture for silverstripe applications
BrettTasker
 
PPTX
Benchmarking NGINX for Accuracy and Results
NGINX, Inc.
 
PPT
Node js
umesh patil
 
PDF
ASP.NET Scalability - WebDD
Phil Pursglove
 
PDF
Building a better web
Fastly
 
PPTX
Level Up: 5 Expert Tips for Optimizing WordPress Performance
Pantheon
 
PPTX
Why Wordnik went non-relational
Tony Tam
 
PDF
ASP.NET Scalability - VBUG London
Phil Pursglove
 
PDF
Supporting large scale React applications
Maurice De Beijer [MVP]
 
PPTX
Windows Azure Service Bus
Pavel Revenkov
 
PDF
A Practical Introduction to Functions-as-a-Service
Valeri Karpov
 
PPTX
Building large scalable mission critical business applications on the web
Maurice De Beijer [MVP]
 
PDF
Inside election night at The New York Times | Altitude NYC
Fastly
 
PPTX
4th Lecture: JSP and such
Manolis Vavalis
 
PPTX
Keeping the Lights On with MongoDB
Tony Tam
 
PDF
Living on the Edge: Elevating your SEO toolkit to the CDN
Nils De Moor
 
PDF
Caching your rails application
ArrrrCamp
 
Performance Testing w/ WebPage Test Private Instance (DrupalCamp Ohio)
Bill Condo
 
The server side story: Parallel and Asynchronous programming in .NET - ITPro...
Panagiotis Kanavos
 
Getting Started with Web Services
DataNext Solutions
 
Silverstripe at scale - design & architecture for silverstripe applications
BrettTasker
 
Benchmarking NGINX for Accuracy and Results
NGINX, Inc.
 
Node js
umesh patil
 
ASP.NET Scalability - WebDD
Phil Pursglove
 
Building a better web
Fastly
 
Level Up: 5 Expert Tips for Optimizing WordPress Performance
Pantheon
 
Why Wordnik went non-relational
Tony Tam
 
ASP.NET Scalability - VBUG London
Phil Pursglove
 
Supporting large scale React applications
Maurice De Beijer [MVP]
 
Windows Azure Service Bus
Pavel Revenkov
 
A Practical Introduction to Functions-as-a-Service
Valeri Karpov
 
Building large scalable mission critical business applications on the web
Maurice De Beijer [MVP]
 
Inside election night at The New York Times | Altitude NYC
Fastly
 
4th Lecture: JSP and such
Manolis Vavalis
 
Keeping the Lights On with MongoDB
Tony Tam
 
Living on the Edge: Elevating your SEO toolkit to the CDN
Nils De Moor
 
Caching your rails application
ArrrrCamp
 

Viewers also liked (6)

PPT
Anatomie mobilního webu
Filip Mares
 
PPTX
Let’s practice critical thinking
coop8
 
PDF
Proofread symbols
Nuestra De Asis
 
PPTX
Komponenty v kaskákdě
Filip Mares
 
PPT
HTML5 Geolocation API
Filip Mares
 
PDF
77094122 report-on-aarong-part-two
এ.আর. সিকদার
 
Anatomie mobilního webu
Filip Mares
 
Let’s practice critical thinking
coop8
 
Proofread symbols
Nuestra De Asis
 
Komponenty v kaskákdě
Filip Mares
 
HTML5 Geolocation API
Filip Mares
 
77094122 report-on-aarong-part-two
এ.আর. সিকদার
 
Ad

Similar to Performance optimization - Basics (20)

PDF
High Performance Ajax Applications
Siarhei Barysiuk
 
PPTX
Web performance optimization for modern web applications
Chris Love
 
PPTX
web performnace optimization using css minification
vishal choudhary
 
PPTX
Building high performing web pages
Nilesh Bafna
 
PPT
Frontend performance
sacred 8
 
PPTX
10 things you can do to speed up your web app today stir trek edition
Chris Love
 
PPTX
Performace optimization (increase website speed)
clickramanm
 
PDF
High performance website
Chamnap Chhorn
 
PPTX
10 things you can do to speed up your web app today 2016
Chris Love
 
PDF
Speed!
Rafael Corral
 
PPT
Css best practices style guide and tips
Chris Love
 
PPT
Cssbestpracticesjstyleguidejandtips 150830184202-lva1-app6892
Deepak Sharma
 
PDF
Highly Maintainable, Efficient, and Optimized CSS
Zoe Gillenwater
 
PPTX
10 Things You Can Do to Speed Up Your Web App Today
Chris Love
 
PDF
Advanced CSS Troubleshooting & Efficiency
Denise Jacobs
 
PPT
performance.ppt
fakeaccount225095
 
PPTX
Building Faster Websites
Craig Walker
 
PDF
Drupal front-end performance
ADCI Solutions
 
PDF
Advanced CSS Troubleshooting
Denise Jacobs
 
PDF
Performance tuning of Websites
muHive Technologies
 
High Performance Ajax Applications
Siarhei Barysiuk
 
Web performance optimization for modern web applications
Chris Love
 
web performnace optimization using css minification
vishal choudhary
 
Building high performing web pages
Nilesh Bafna
 
Frontend performance
sacred 8
 
10 things you can do to speed up your web app today stir trek edition
Chris Love
 
Performace optimization (increase website speed)
clickramanm
 
High performance website
Chamnap Chhorn
 
10 things you can do to speed up your web app today 2016
Chris Love
 
Css best practices style guide and tips
Chris Love
 
Cssbestpracticesjstyleguidejandtips 150830184202-lva1-app6892
Deepak Sharma
 
Highly Maintainable, Efficient, and Optimized CSS
Zoe Gillenwater
 
10 Things You Can Do to Speed Up Your Web App Today
Chris Love
 
Advanced CSS Troubleshooting & Efficiency
Denise Jacobs
 
performance.ppt
fakeaccount225095
 
Building Faster Websites
Craig Walker
 
Drupal front-end performance
ADCI Solutions
 
Advanced CSS Troubleshooting
Denise Jacobs
 
Performance tuning of Websites
muHive Technologies
 
Ad

Recently uploaded (20)

PDF
Reverse Engineering of Security Products: Developing an Advanced Microsoft De...
nwbxhhcyjv
 
PPTX
AI Penetration Testing Essentials: A Cybersecurity Guide for 2025
defencerabbit Team
 
PPTX
Building Search Using OpenSearch: Limitations and Workarounds
Sease
 
PDF
LOOPS in C Programming Language - Technology
RishabhDwivedi43
 
PDF
Building Real-Time Digital Twins with IBM Maximo & ArcGIS Indoors
Safe Software
 
PDF
Empower Inclusion Through Accessible Java Applications
Ana-Maria Mihalceanu
 
PDF
Smart Trailers 2025 Update with History and Overview
Paul Menig
 
PPTX
Designing Production-Ready AI Agents
Kunal Rai
 
PDF
[Newgen] NewgenONE Marvin Brochure 1.pdf
darshakparmar
 
PDF
New from BookNet Canada for 2025: BNC BiblioShare - Tech Forum 2025
BookNet Canada
 
PDF
CIFDAQ Market Insights for July 7th 2025
CIFDAQ
 
PDF
Newgen Beyond Frankenstein_Build vs Buy_Digital_version.pdf
darshakparmar
 
PDF
POV_ Why Enterprises Need to Find Value in ZERO.pdf
darshakparmar
 
PDF
What Makes Contify’s News API Stand Out: Key Features at a Glance
Contify
 
PDF
Advancing WebDriver BiDi support in WebKit
Igalia
 
PDF
CIFDAQ Token Spotlight for 9th July 2025
CIFDAQ
 
PDF
Go Concurrency Real-World Patterns, Pitfalls, and Playground Battles.pdf
Emily Achieng
 
PDF
Bitcoin for Millennials podcast with Bram, Power Laws of Bitcoin
Stephen Perrenod
 
PDF
Staying Human in a Machine- Accelerated World
Catalin Jora
 
PDF
The Rise of AI and IoT in Mobile App Tech.pdf
IMG Global Infotech
 
Reverse Engineering of Security Products: Developing an Advanced Microsoft De...
nwbxhhcyjv
 
AI Penetration Testing Essentials: A Cybersecurity Guide for 2025
defencerabbit Team
 
Building Search Using OpenSearch: Limitations and Workarounds
Sease
 
LOOPS in C Programming Language - Technology
RishabhDwivedi43
 
Building Real-Time Digital Twins with IBM Maximo & ArcGIS Indoors
Safe Software
 
Empower Inclusion Through Accessible Java Applications
Ana-Maria Mihalceanu
 
Smart Trailers 2025 Update with History and Overview
Paul Menig
 
Designing Production-Ready AI Agents
Kunal Rai
 
[Newgen] NewgenONE Marvin Brochure 1.pdf
darshakparmar
 
New from BookNet Canada for 2025: BNC BiblioShare - Tech Forum 2025
BookNet Canada
 
CIFDAQ Market Insights for July 7th 2025
CIFDAQ
 
Newgen Beyond Frankenstein_Build vs Buy_Digital_version.pdf
darshakparmar
 
POV_ Why Enterprises Need to Find Value in ZERO.pdf
darshakparmar
 
What Makes Contify’s News API Stand Out: Key Features at a Glance
Contify
 
Advancing WebDriver BiDi support in WebKit
Igalia
 
CIFDAQ Token Spotlight for 9th July 2025
CIFDAQ
 
Go Concurrency Real-World Patterns, Pitfalls, and Playground Battles.pdf
Emily Achieng
 
Bitcoin for Millennials podcast with Bram, Power Laws of Bitcoin
Stephen Perrenod
 
Staying Human in a Machine- Accelerated World
Catalin Jora
 
The Rise of AI and IoT in Mobile App Tech.pdf
IMG Global Infotech
 

Performance optimization - Basics

  • 1. Performance optimization ID meeting 13 th January 2010 Filip Mares
  • 2. Agenda •Why Optimise Front-End? •Importance of performance •34 best practices •Optimize CSS for faster browser rendering •Write efficient CSS •Minify CSS
  • 3. Why Optimise Front-End? • More potential for improvement • Typically require less time = lower costs • It’s proven to work
  • 4. Importance of performance • Better user experience • More traffic +0.4s = 5-9% drop in full-page traffic (Yahoo!) • More revenue +1sec = 2.8% drop in revenue • Reduced costs HW costs, bandwidth costs
  • 5. Make it right before you make it fast
  • 6. 34 best practices (by YDN) 1. Make fewer HTTP Requests 18. Preload Components 2. Use a Content Delivery Network 19. Reduce the Number of DOM Elements 3. Add an Expires or a Cache-Control Header 20. Split Components Across Domains 4. Gzip Components 21. Minimize the Number of iframes 5. Put Style sheets at the Top 22. No 404s 6. Put Scripts at the Bottom 23. Reduce Cookie Size 7. Avoid CSS Expressions 24. Use Cookie-free Domains for Components 8. Make JavaScript and CSS External 25. Minimize DOM Access 9. Reduce DNS Lookups 26. Develop Smart Event Handlers 10. Minify JavaScript and CSS 27. Choose <link> over @import 11. Avoid Redirects 28. Avoid Filters 12. Remove Duplicate JS and CSS 29. Optimize Images 13. Configure ETags 30. Optimize CSS Sprites 14. Make Ajax Cacheable 31. Don’t Scale Images in HTML 15. Flush the Buffer Early 32. Make favicon.ico Small and Cacheable 16. Use GET for Ajax Requests 33. Keep Components under 25K 17. Post-load Components 34. Pack Components into a Multipart Document
  • 7. 23 best practices for IDs 1. Make fewer HTTP Requests 18. Preload Components 2. Use a Content Delivery Network 19. Reduce the Number of DOM Elements 3. Add an Expires or a Cache-Control Header 20. Split Components Across Domains 4. Gzip Components 21. Minimize the Number of iframes 5. Put Style sheets at the Top 22. No 404s 6. Put Scripts at the Bottom 23. Reduce Cookie Size 7. Avoid CSS Expressions 24. Use Cookie-free Domains for Components 8. Make JavaScript and CSS External 25. Minimize DOM Access 9. Reduce DNS Lookups 26. Develop Smart Event Handlers 10. Minify JavaScript and CSS 27. Choose <link> over @import 11. Avoid Redirects 28. Avoid Filters 12. Remove Duplicate JS and CSS 29. Optimize Images 13. Configure ETags 30. Optimize CSS Sprites 14. Make Ajax Cacheable 31. Don’t Scale Images in HTML 15. Flush the Buffer Early 32. Make favicon.ico Small and Cacheable 16. Use GET for Ajax Requests 33. Keep Components under 25K 17. Post-load Components 34. Pack Components into a Multipart Document
  • 8. Optimize CSS for faster browser rendering
  • 9. Less HTTP requests • Combine CSS files No separate print CSS • Inline images with data background‐image: url("data:image/png;base64,iVBORw0KG..."); • Lazy-load stylesheets used by JavaScript CSS files on demand
  • 10. Less HTTP requests - drawback •Bigger files or more combinations to cache •Not as nice as atomic components •Inline images does not work in IE up to IE7 •Hard to make even small changes •Need of new filename when the „never expire“ policy is on
  • 11. Other CSS optimization practices •Put CSS in the document head •Make CSS External •Choose <link> over @import •Avoid Filters •Avoid CSS expressions •Specify image dimensions
  • 13. Descendants and child selectors can affect performance, but don’t worry about them so much as to not use them.
  • 14. Efficient CSS practices •Group selectors with common declarations •Use CSS shorthand #nav {text-align: center} #main{text-align: center} #nav, #main{text-align: center} #nav {margin:2em 1em 3em 1em; padding: 0em; color:#ffcc00} #nav {margin:2em 1em 3em; padding: 0; color:#fc0} •Group declarations with common selectors •Abbreviate long class and ID names #nav {text-align: center} #nav {color:#eee} #nav {text-align: center; color:#eee} •Combine common styles into shared classes •Keep the cascade in mind •Use inheritance to eliminate duplicate declarations •Remove unused CSS •Make rules as specific as possible •Avoid universal rules •Remove redundant qualifiers •Avoid descendant selectors, especially those that specify redundant ancestors •Avoid the :hover pseudo-selector for non-link elements for IE clients
  • 15. Inefficient rules •Rules with descendant selectors body * ul li a •Rules with child or adjacent selectors body > * ul > li > a •Rules with overly qualified selectors form#UserLogin •Rules that apply the :hover pseudo-selector to non-link elements h3:hover
  • 17. Tested tools •Clean CSS •CSS Optimiser •Icey CSS Compressor •YUI Compressor •flumpCakes Optimiser
  • 18. Tested tools - results Tool Used File Size Lines compression ratio: None 12,875 227 Original Clean CSS 11,735 940 9% CSS Optimiser 11,304 2 12% Icey CSS Compressor 10,383 1 19% YUI Compressor 11,175 1 13% 796 0% Flumpcakes Optimiser 12,885
  • 21. Links •Best Practices for Speeding Up Your Web Site http://developer.yahoo.com/performance/rules.html •Testing CSS Performance http://blog.archive.jpsykes.com/151/testing-css-performance/ •Performance Impact of CSS Selectors http://www.stevesouders.com/blog/2009/03/10/performance-impact-of-css-selectors/ •Optimize browser rendering http://code.google.com/speed/page-speed/docs/rendering.html •CSS Optimization: Make Your Sites Load Faster for Free http://www.bloggingpro.com/archives/2006/08/17/css-optimization/