SlideShare a Scribd company logo
1 of 42
Download to read offline
Web & Mobile
optimization




   by Kirill Cebotari
  drupal.org @oresh
Content table

1. Why optimize?
2. Javascript optimize.
3. CSS optimization.
4. Image optimization.
5. Http requests.
6. Drupal modules.
7. Demo
Why optimize?
i can run 2.37 miles
while i get to the contacts page


                               i'm still loading...
— No need to worry, just running by...
ok, open this page
 waiting...
  I'm hungry
     cook something for dinner
     meeh...
     I'm going to Mo's
      *going away



    1 second is the focus time
Traffic can be expensive
Javascript optimization
It's 3.57 PetaFlops, Chubaka!
Make tests   http://jsperf.com/math-floor-vs-math-round-vs-parseint/5
Follow good practices
http://www.javascripttoolbox.com/bestpractices/
http://coding.smashingmagazine.com/2012/11/05/writing-fast-memory-efficient-
javascript/
http://www.html5rocks.com/en/tutorials/speed/v8/
http://jonraasch.com/blog/10-javascript-performance-boosting-tips-from-nicholas-zakas
http://net.tutsplus.com/tutorials/javascript-ajax/24-javascript-best-practices-for-
beginners/
http://docs.webplatform.org/wiki/javascript


And many others...
Use JSLint




JSLint is a JavaScript program that looks for
problems in JavaScript programs. It is a code
quality tool. Like a Boss.
Keep experimenting.
http://tutorialzine.com/2013/04/50-amazing-jquery-plugins/
CSS optimization
Use SMACSS or similar principles




                         chop chop chop chop...
Don't slow down your selectors

                                                     two more divs
                                                     and I'm home...




body div#content .content > div > div> ul.menu li[class~="item"] ul li
CSS Selectors speed
   I.   ID ( #top )
  II.   Class ( .container )
 III.   Node/Element Type ( div )
  IV.   Sibling ( p + img )
   V.   Child ( ul > li )
  VI.   Descendant ( p strong )
 VII.   Universal ( * )
VIII.   By Attribute ( [type="text"] )
  IX.   Pseudo Elements/Classes ( a:hover )
I.   ID ( #top )
  II.   Class ( .container )
 III.   Node/Element Type ( div )
  IV.   Sibling ( p + img )
   V.   Child ( ul > li )
  VI.   Descendant ( p strong )
 VII.   Universal ( * )
VIII.   By Attribute ( [type="text"] )
  IX.   Pseudo Elements/Classes ( a:hover )
Whyyyy so slow?!??!?!
Use SASS or LESS
Y U No let me use !important ?!
Image optimization
Image impact:

   simple page
   with images


                  simple page
                 without images
                                     optimized
                                   simple page
                                  without images
5MB image on
frontpage? Sure!
Use tiny png




               *he'll eat out all your
               KBytes
Choose wisely




        *http://luci.criosweb.ro/riot/
Optimize your images
before uploading
http://www.smashingmagazine.com/2009/07/01/clever-jpeg-optimization-
techniques/

http://sixrevisions.com/tools/8-excellent-tools-for-optimizing-your-images/

http://www.imageoptimizer.net/Pages/Home.aspx
love sprites
Use CSS3 Gradients




                     *css is awesome!
HTTP requests
It really matters
IE 6/7: 2
IE 8: 2 on dialup, 6 on broadband
IE 9: 6
IE 10: 8
Firefox: 6-8
Safari: 4-6
Chrome: 6-12
Review your files
Parallel Downloads




http://yuiblog.com/blog/2007/04/11/performance-research-part-4/
http://css-tricks.com/images-on-a-subdomain/
Drupal projects.
Break points
http://drupal.org/project/breakpoints
Responsive images
Responsive images and styles
project:
http://drupal.org/project/resp_img

video:
http://modulesunraveled.com/responsive-images/part-1-installation

documentation:
http://drupal.org/node/1904690
Simular projects
1) Responsive Images
 - works as a field formatter
 - only supports 2 sizes
2) Adaptive Image
 - works with screen size, not window size
3) Adaptive Image Styles (ais)
 - needs .htaccess rules
4) Client-side adaptive image
 - works as a field formatter
5) Media: Responsive
 - works only on media field
 - set as maximum width
 - uses css for the smaller variants
Demo and browser tools.
Thank you!




Kirill Cebotari
drupal.org @oresh

irc: #drupal-mobile

More Related Content

Similar to Mobile and web optimization + Drupal

HTML5 Who what where when why how
HTML5 Who what where when why howHTML5 Who what where when why how
HTML5 Who what where when why how
brucelawson
 
Build Your Own CMS with Apache Sling
Build Your Own CMS with Apache SlingBuild Your Own CMS with Apache Sling
Build Your Own CMS with Apache Sling
Bob Paulin
 
Web app and more
Web app and moreWeb app and more
Web app and more
faming su
 
Even faster web sites
Even faster web sitesEven faster web sites
Even faster web sites
Felipe Lavín
 
Web Directions South - Even Faster Web Sites
Web Directions South - Even Faster Web SitesWeb Directions South - Even Faster Web Sites
Web Directions South - Even Faster Web Sites
Steve Souders
 
Chapter15-Presentation.pptx
Chapter15-Presentation.pptxChapter15-Presentation.pptx
Chapter15-Presentation.pptx
GFRomano
 

Similar to Mobile and web optimization + Drupal (20)

HTML5 Who what where when why how
HTML5 Who what where when why howHTML5 Who what where when why how
HTML5 Who what where when why how
 
JavaScript performance patterns
JavaScript performance patternsJavaScript performance patterns
JavaScript performance patterns
 
Build Your Own CMS with Apache Sling
Build Your Own CMS with Apache SlingBuild Your Own CMS with Apache Sling
Build Your Own CMS with Apache Sling
 
10 Web Performance Lessons For the 21st Century
10 Web Performance Lessons For the  21st Century10 Web Performance Lessons For the  21st Century
10 Web Performance Lessons For the 21st Century
 
SPSDenver - SharePoint & jQuery - What I wish I would have known
SPSDenver - SharePoint & jQuery - What I wish I would have knownSPSDenver - SharePoint & jQuery - What I wish I would have known
SPSDenver - SharePoint & jQuery - What I wish I would have known
 
JavaScript Performance Patterns
JavaScript Performance PatternsJavaScript Performance Patterns
JavaScript Performance Patterns
 
Developing web applications in 2010
Developing web applications in 2010Developing web applications in 2010
Developing web applications in 2010
 
Introduction to jQuery
Introduction to jQueryIntroduction to jQuery
Introduction to jQuery
 
Stefan Judis "Did we(b development) lose the right direction?"
Stefan Judis "Did we(b development) lose the right direction?"Stefan Judis "Did we(b development) lose the right direction?"
Stefan Judis "Did we(b development) lose the right direction?"
 
Web Apps and more
Web Apps and moreWeb Apps and more
Web Apps and more
 
Web app and more
Web app and moreWeb app and more
Web app and more
 
Look ma! No images!
Look ma! No images!Look ma! No images!
Look ma! No images!
 
Even faster web sites
Even faster web sitesEven faster web sites
Even faster web sites
 
Now you see me... Adaptive Web Design and Development
Now you see me... Adaptive Web Design and DevelopmentNow you see me... Adaptive Web Design and Development
Now you see me... Adaptive Web Design and Development
 
Disruptive code
Disruptive codeDisruptive code
Disruptive code
 
Web Directions South - Even Faster Web Sites
Web Directions South - Even Faster Web SitesWeb Directions South - Even Faster Web Sites
Web Directions South - Even Faster Web Sites
 
Chapter15-Presentation.pptx
Chapter15-Presentation.pptxChapter15-Presentation.pptx
Chapter15-Presentation.pptx
 
A practical guide to building websites with HTML5 & CSS3
A practical guide to building websites with HTML5 & CSS3A practical guide to building websites with HTML5 & CSS3
A practical guide to building websites with HTML5 & CSS3
 
Progressive Enhancement 2.0 (jQuery Conference SF Bay Area 2011)
Progressive Enhancement 2.0 (jQuery Conference SF Bay Area 2011)Progressive Enhancement 2.0 (jQuery Conference SF Bay Area 2011)
Progressive Enhancement 2.0 (jQuery Conference SF Bay Area 2011)
 
From Hacker to Programmer (w/ Webpack, Babel and React)
From Hacker to Programmer (w/ Webpack, Babel and React)From Hacker to Programmer (w/ Webpack, Babel and React)
From Hacker to Programmer (w/ Webpack, Babel and React)
 

More from Kirill Borzov

More from Kirill Borzov (9)

Учимся Руководить
Учимся РуководитьУчимся Руководить
Учимся Руководить
 
UX for Busy People
UX for Busy PeopleUX for Busy People
UX for Busy People
 
Lets talk about JavaScript (at JSMD Meetup #7)
Lets talk about JavaScript (at JSMD Meetup #7)Lets talk about JavaScript (at JSMD Meetup #7)
Lets talk about JavaScript (at JSMD Meetup #7)
 
Timber Wordpress presentation
Timber Wordpress presentationTimber Wordpress presentation
Timber Wordpress presentation
 
Panels: how to fire Front-end developer
Panels: how to fire  Front-end developerPanels: how to fire  Front-end developer
Panels: how to fire Front-end developer
 
Drupal 7 — Circle theme
Drupal 7 — Circle themeDrupal 7 — Circle theme
Drupal 7 — Circle theme
 
Theming in Drupal 8 (everything)
Theming in Drupal 8 (everything)Theming in Drupal 8 (everything)
Theming in Drupal 8 (everything)
 
RailsGirls Mixbook presentation
RailsGirls Mixbook presentationRailsGirls Mixbook presentation
RailsGirls Mixbook presentation
 
Рекрутинг.Js
Рекрутинг.JsРекрутинг.Js
Рекрутинг.Js
 

Recently uploaded

+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
Joaquim Jorge
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 

Recently uploaded (20)

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
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
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
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
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
 
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
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
HTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesHTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation Strategies
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
+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...
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024
 
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
 
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)
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 

Mobile and web optimization + Drupal