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

TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...
TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...
TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...
TrustArc
 

Recently uploaded (20)

UiPath manufacturing technology benefits and AI overview
UiPath manufacturing technology benefits and AI overviewUiPath manufacturing technology benefits and AI overview
UiPath manufacturing technology benefits and AI overview
 
Event-Driven Architecture Masterclass: Integrating Distributed Data Stores Ac...
Event-Driven Architecture Masterclass: Integrating Distributed Data Stores Ac...Event-Driven Architecture Masterclass: Integrating Distributed Data Stores Ac...
Event-Driven Architecture Masterclass: Integrating Distributed Data Stores Ac...
 
Portal Kombat : extension du réseau de propagande russe
Portal Kombat : extension du réseau de propagande russePortal Kombat : extension du réseau de propagande russe
Portal Kombat : extension du réseau de propagande russe
 
Working together SRE & Platform Engineering
Working together SRE & Platform EngineeringWorking together SRE & Platform Engineering
Working together SRE & Platform Engineering
 
Intro in Product Management - Коротко про професію продакт менеджера
Intro in Product Management - Коротко про професію продакт менеджераIntro in Product Management - Коротко про професію продакт менеджера
Intro in Product Management - Коротко про професію продакт менеджера
 
Extensible Python: Robustness through Addition - PyCon 2024
Extensible Python: Robustness through Addition - PyCon 2024Extensible Python: Robustness through Addition - PyCon 2024
Extensible Python: Robustness through Addition - PyCon 2024
 
Observability Concepts EVERY Developer Should Know (DevOpsDays Seattle)
Observability Concepts EVERY Developer Should Know (DevOpsDays Seattle)Observability Concepts EVERY Developer Should Know (DevOpsDays Seattle)
Observability Concepts EVERY Developer Should Know (DevOpsDays Seattle)
 
State of the Smart Building Startup Landscape 2024!
State of the Smart Building Startup Landscape 2024!State of the Smart Building Startup Landscape 2024!
State of the Smart Building Startup Landscape 2024!
 
Long journey of Ruby Standard library at RubyKaigi 2024
Long journey of Ruby Standard library at RubyKaigi 2024Long journey of Ruby Standard library at RubyKaigi 2024
Long journey of Ruby Standard library at RubyKaigi 2024
 
The Value of Certifying Products for FDO _ Paul at FIDO Alliance.pdf
The Value of Certifying Products for FDO _ Paul at FIDO Alliance.pdfThe Value of Certifying Products for FDO _ Paul at FIDO Alliance.pdf
The Value of Certifying Products for FDO _ Paul at FIDO Alliance.pdf
 
TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...
TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...
TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...
 
Where to Learn More About FDO _ Richard at FIDO Alliance.pdf
Where to Learn More About FDO _ Richard at FIDO Alliance.pdfWhere to Learn More About FDO _ Richard at FIDO Alliance.pdf
Where to Learn More About FDO _ Richard at FIDO Alliance.pdf
 
Using IESVE for Room Loads Analysis - UK & Ireland
Using IESVE for Room Loads Analysis - UK & IrelandUsing IESVE for Room Loads Analysis - UK & Ireland
Using IESVE for Room Loads Analysis - UK & Ireland
 
Design Guidelines for Passkeys 2024.pptx
Design Guidelines for Passkeys 2024.pptxDesign Guidelines for Passkeys 2024.pptx
Design Guidelines for Passkeys 2024.pptx
 
Linux Foundation Edge _ Overview of FDO Software Components _ Randy at Intel.pdf
Linux Foundation Edge _ Overview of FDO Software Components _ Randy at Intel.pdfLinux Foundation Edge _ Overview of FDO Software Components _ Randy at Intel.pdf
Linux Foundation Edge _ Overview of FDO Software Components _ Randy at Intel.pdf
 
How we scaled to 80K users by doing nothing!.pdf
How we scaled to 80K users by doing nothing!.pdfHow we scaled to 80K users by doing nothing!.pdf
How we scaled to 80K users by doing nothing!.pdf
 
Event-Driven Architecture Masterclass: Challenges in Stream Processing
Event-Driven Architecture Masterclass: Challenges in Stream ProcessingEvent-Driven Architecture Masterclass: Challenges in Stream Processing
Event-Driven Architecture Masterclass: Challenges in Stream Processing
 
JavaScript Usage Statistics 2024 - The Ultimate Guide
JavaScript Usage Statistics 2024 - The Ultimate GuideJavaScript Usage Statistics 2024 - The Ultimate Guide
JavaScript Usage Statistics 2024 - The Ultimate Guide
 
Collecting & Temporal Analysis of Behavioral Web Data - Tales From The Inside
Collecting & Temporal Analysis of Behavioral Web Data - Tales From The InsideCollecting & Temporal Analysis of Behavioral Web Data - Tales From The Inside
Collecting & Temporal Analysis of Behavioral Web Data - Tales From The Inside
 
WebRTC and SIP not just audio and video @ OpenSIPS 2024
WebRTC and SIP not just audio and video @ OpenSIPS 2024WebRTC and SIP not just audio and video @ OpenSIPS 2024
WebRTC and SIP not just audio and video @ OpenSIPS 2024
 

Mobile and web optimization + Drupal