SlideShare a Scribd company logo
1 of 17
Download to read offline
Client Side Performance
Compromises Worth
Making
Sydney Web Apps Group: 19.9.13
@cathyblabla
What!!?
Good client-side performance really is simple -
smaller files, fewer HTTP requests, less DOM
manipulation. Use YSlow and understand the
rules it is based on.
OK, so there are lots of tricky details that we
could go into, like CSS selector performance,
but is your site huge enough for things like that
to make a difference? Probably not. So….
Where to draw the line
Where do you draw the line between good
performance and maintainability? Class names
like ‘a1’ to make your CSS files smaller? No
way! But there some situations where ‘The
Rules’ can and should be bent...
Multiple sprite images
Sprites allows us to download all our image
assets in one request. If you use Compass, it’s
sprite functionality makes this super simple.
But all those disparate colour palettes add up,
resulting in either a big 32bit PNG or degraded
colour reproduction. The solution? Split up your
sprites into similar colour groups and stick to a
set pallette. It’s a few more HTTP requests but
worth it.
Like this...
$green-sprites: sprite-map("sprites/green/*.png");
$grey-sprites: sprite-map("sprites/grey/*.png");
%mail-icon {
background: sprite($grey-sprites, mail) no-repeat;
&:hover {
background: sprite($green-sprites, mail) no-repeat;
}
}
Scaling images in HTML
Ideally, we would only download images at the
exact size they will be displayed, but your
responsive site will probably call for fluid
images to cater for different devices - what to
do!?
If you can, serve different sized images based
on device categories then allow CSS scaling to
take over.
Choose image sizes that match your target
devices closely and that are close to the upper
end of your breakpoint to minimise image
degradation.
Include the served image’s width and height in
your html to reduce the visible effect of reflows
once your image is loaded.
Load (most) scripts at the bottom of
the page
Inserting scripts at the end of your page stops
script downloads from blocking the rest of your
content. But long pages can result in a
noticeable lag for script effects - while your
overall page load time may be improved the
users’ perception of load time could be
affected.
...so should I load my scripts in
<head> after all?
One approach is to load your ‘must have’
scripts in the head, then load the rest at the
bottom of the page. While this introduces some
maintenance overhead, your page loads as fast
as possible while also giving your users a
seamless experience.
Script loaders FTW!
RequireJS is a script loader that present a
unique solution to this problem. Out of the box,
RequireJS loads modules asynchronously as
they are called for. There is also an
optimisation tool that provides an automated
build. All the files required for your project are
minified and concatenated, this file is then
loaded asynchronously. Your scripts are
optimised, available earlier and are non-
blocking. Yay!
What about lazy loading?
It is possible to squeeze even more
performance out of your Require scripts by
splitting them up and lazy loading those that
are less often needed. Read about it here.
YUI includes a script loader that is based on
RequireJS but also utilises a server side combo
handler that serves back separate files in one
request. The combo loader is open source and
you can get it here.
Some OO in your SASS
Love the modular approach of OOCSS but don’
t like your HTML getting cluttered up with non
semantic class names? With SASS you have
the tools to write modular, concise code that
can be constructed in any way you wish.
Create a structural hierarchy within your SASS
code and push design complexity back to the
style layer to keep your HTML simple and
readable.
Use placeholders to create re-usable
structures...
%btn {
@include rnd( 3px );
border: 1px solid grey;
cursor: pointer;
line-height: 2.3;
padding: 0 17px;
text-decoration: none;
}
.my-button {
@extend %btn;
color: green;
}
Build up top level rules from
combinations of re-usables
.news-module {
@extend %media-block;
@extend %media-module;
.top-stories {
@extend %stories-list;
}
.more-link {
@extend %btn;
}
}
Mixins give you more flexibility...
@mixin button ($colour: green) {
@include background-image(
linear-gradient(white, $colour)
);
border: 1px solid darken($colour, 40%);
color: 1px solid lighten($colour, 20%);
}
.delete-button {
@include button(red);
}
.active-button {
@include button(blue);
}
But be careful of the final output...
Placeholders generate a single rule with all
selectors combined. If you have too many, IE
goes kaboom!
.btn1, .btn2, .btn { //styles extended from %btn }
Mixin styles are repeated wherever they are
used, so use them minimally, ideally for styles
that are unique (ie, based on a parameter).
.delete-button {
background-image(
linear-gradient(white, red)
);
border: 1px solid #660000;
color: 1px solid #FFBFBF;
}
.active-button {
background-image(
linear-gradient(white, blue)
);
border: 1px solid #000066;
color: 1px solid #99CCFF;
}

More Related Content

What's hot

Introduction to Web Development
Introduction to Web DevelopmentIntroduction to Web Development
Introduction to Web DevelopmentParvez Mahbub
 
Asp.net introduction
Asp.net introductionAsp.net introduction
Asp.net introductionKshitij Wagle
 
Ajax
AjaxAjax
AjaxHome
 
Html Templating - DOT JS
Html Templating - DOT JSHtml Templating - DOT JS
Html Templating - DOT JSNagaraju Sangam
 
Web Development basics with WordPress
Web Development basics with WordPressWeb Development basics with WordPress
Web Development basics with WordPressRashna Maharjan
 
The Importance Things of Full Stack Development
The Importance Things of Full Stack DevelopmentThe Importance Things of Full Stack Development
The Importance Things of Full Stack DevelopmentMike Taylor
 
Scaling Wordpress
Scaling WordpressScaling Wordpress
Scaling Wordpressngonpham
 
Introduction to Basic Concepts in Web
Introduction to Basic Concepts in WebIntroduction to Basic Concepts in Web
Introduction to Basic Concepts in WebJussi Pohjolainen
 
Thin Server Architecture SPA, 5 years old presentation
Thin Server Architecture SPA, 5 years old presentationThin Server Architecture SPA, 5 years old presentation
Thin Server Architecture SPA, 5 years old presentationDavid Amend
 
Introduction To Website Development
Introduction To Website DevelopmentIntroduction To Website Development
Introduction To Website Developmentzaidfarooqui974
 
Client side vs server side
Client side vs server sideClient side vs server side
Client side vs server sideabgjim96
 
Thin Server Architecture
Thin Server ArchitectureThin Server Architecture
Thin Server ArchitectureMitch Pirtle
 
Web development classes in pune
Web development classes in puneWeb development classes in pune
Web development classes in puneNidhi Samdani
 
Web deveplopment courses in pune
Web deveplopment courses  in puneWeb deveplopment courses  in pune
Web deveplopment courses in puneNidhi Samdani
 

What's hot (18)

Introduction to Web Development
Introduction to Web DevelopmentIntroduction to Web Development
Introduction to Web Development
 
Asp.net introduction
Asp.net introductionAsp.net introduction
Asp.net introduction
 
Ajax
AjaxAjax
Ajax
 
Ajax
AjaxAjax
Ajax
 
Html Templating - DOT JS
Html Templating - DOT JSHtml Templating - DOT JS
Html Templating - DOT JS
 
Web Development basics with WordPress
Web Development basics with WordPressWeb Development basics with WordPress
Web Development basics with WordPress
 
The Importance Things of Full Stack Development
The Importance Things of Full Stack DevelopmentThe Importance Things of Full Stack Development
The Importance Things of Full Stack Development
 
Scaling Wordpress
Scaling WordpressScaling Wordpress
Scaling Wordpress
 
Top web development tools
Top web development toolsTop web development tools
Top web development tools
 
Web development
Web developmentWeb development
Web development
 
Introduction to Basic Concepts in Web
Introduction to Basic Concepts in WebIntroduction to Basic Concepts in Web
Introduction to Basic Concepts in Web
 
Thin Server Architecture SPA, 5 years old presentation
Thin Server Architecture SPA, 5 years old presentationThin Server Architecture SPA, 5 years old presentation
Thin Server Architecture SPA, 5 years old presentation
 
Introduction To Website Development
Introduction To Website DevelopmentIntroduction To Website Development
Introduction To Website Development
 
Client side vs server side
Client side vs server sideClient side vs server side
Client side vs server side
 
Web 2.0
Web 2.0Web 2.0
Web 2.0
 
Thin Server Architecture
Thin Server ArchitectureThin Server Architecture
Thin Server Architecture
 
Web development classes in pune
Web development classes in puneWeb development classes in pune
Web development classes in pune
 
Web deveplopment courses in pune
Web deveplopment courses  in puneWeb deveplopment courses  in pune
Web deveplopment courses in pune
 

Similar to Client side performance compromises worth making

Organize Your Website With Advanced CSS Tricks
Organize Your Website With Advanced CSS TricksOrganize Your Website With Advanced CSS Tricks
Organize Your Website With Advanced CSS TricksAndolasoft Inc
 
Building high performing web pages
Building high performing web pagesBuilding high performing web pages
Building high performing web pagesNilesh Bafna
 
Presentation about html5 css3
Presentation about html5 css3Presentation about html5 css3
Presentation about html5 css3Gopi A
 
Websites Unlimited - Pay Monthly Websites
Websites Unlimited - Pay Monthly WebsitesWebsites Unlimited - Pay Monthly Websites
Websites Unlimited - Pay Monthly Websiteswebsiteunlimited
 
Making Of PHP Based Web Application
Making Of PHP Based Web ApplicationMaking Of PHP Based Web Application
Making Of PHP Based Web ApplicationSachin Walvekar
 
Modern ux-workflow-presentation
Modern ux-workflow-presentationModern ux-workflow-presentation
Modern ux-workflow-presentationBrian Akpa
 
Intro to mobile web application development
Intro to mobile web application developmentIntro to mobile web application development
Intro to mobile web application developmentzonathen
 
Bootstrap for Beginners
Bootstrap for BeginnersBootstrap for Beginners
Bootstrap for BeginnersD'arce Hess
 
CSS3 and a brief introduction to Google Maps API v3
CSS3 and a brief introduction to Google Maps API v3 CSS3 and a brief introduction to Google Maps API v3
CSS3 and a brief introduction to Google Maps API v3 Jeffrey Barke
 
Static site best practices
Static site best practicesStatic site best practices
Static site best practicesAllanki Srinivas
 
Website Performance at Client Level
Website Performance at Client LevelWebsite Performance at Client Level
Website Performance at Client LevelConstantin Stan
 
What is LessCSS and its Detailed Explation - Xhtmlchop
What is LessCSS and its Detailed Explation - XhtmlchopWhat is LessCSS and its Detailed Explation - Xhtmlchop
What is LessCSS and its Detailed Explation - Xhtmlchopxhtmlchop
 
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)Folio3 Software
 
An Introduction to CSS Frameworks
An Introduction to CSS FrameworksAn Introduction to CSS Frameworks
An Introduction to CSS FrameworksAdrian Westlake
 
Top Front-End Frameworks For Your Web Development Projects.pdf
Top Front-End Frameworks For Your Web Development Projects.pdfTop Front-End Frameworks For Your Web Development Projects.pdf
Top Front-End Frameworks For Your Web Development Projects.pdfCalvinLee106
 

Similar to Client side performance compromises worth making (20)

Organize Your Website With Advanced CSS Tricks
Organize Your Website With Advanced CSS TricksOrganize Your Website With Advanced CSS Tricks
Organize Your Website With Advanced CSS Tricks
 
Building high performing web pages
Building high performing web pagesBuilding high performing web pages
Building high performing web pages
 
Presentation about html5 css3
Presentation about html5 css3Presentation about html5 css3
Presentation about html5 css3
 
WEB DEVELOPMENT
WEB DEVELOPMENTWEB DEVELOPMENT
WEB DEVELOPMENT
 
Websites Unlimited - Pay Monthly Websites
Websites Unlimited - Pay Monthly WebsitesWebsites Unlimited - Pay Monthly Websites
Websites Unlimited - Pay Monthly Websites
 
Making Of PHP Based Web Application
Making Of PHP Based Web ApplicationMaking Of PHP Based Web Application
Making Of PHP Based Web Application
 
Modern ux-workflow-presentation
Modern ux-workflow-presentationModern ux-workflow-presentation
Modern ux-workflow-presentation
 
Asp.Net Tips
Asp.Net TipsAsp.Net Tips
Asp.Net Tips
 
Intro to mobile web application development
Intro to mobile web application developmentIntro to mobile web application development
Intro to mobile web application development
 
Bootstrap for Beginners
Bootstrap for BeginnersBootstrap for Beginners
Bootstrap for Beginners
 
CSS3 and a brief introduction to Google Maps API v3
CSS3 and a brief introduction to Google Maps API v3 CSS3 and a brief introduction to Google Maps API v3
CSS3 and a brief introduction to Google Maps API v3
 
Static site best practices
Static site best practicesStatic site best practices
Static site best practices
 
NodeJs Frameworks.pdf
NodeJs Frameworks.pdfNodeJs Frameworks.pdf
NodeJs Frameworks.pdf
 
Website Performance at Client Level
Website Performance at Client LevelWebsite Performance at Client Level
Website Performance at Client Level
 
ashish ppt webd.pptx
ashish ppt webd.pptxashish ppt webd.pptx
ashish ppt webd.pptx
 
HTML CSS & Javascript
HTML CSS & JavascriptHTML CSS & Javascript
HTML CSS & Javascript
 
What is LessCSS and its Detailed Explation - Xhtmlchop
What is LessCSS and its Detailed Explation - XhtmlchopWhat is LessCSS and its Detailed Explation - Xhtmlchop
What is LessCSS and its Detailed Explation - Xhtmlchop
 
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 Introduction to CSS Frameworks
An Introduction to CSS FrameworksAn Introduction to CSS Frameworks
An Introduction to CSS Frameworks
 
Top Front-End Frameworks For Your Web Development Projects.pdf
Top Front-End Frameworks For Your Web Development Projects.pdfTop Front-End Frameworks For Your Web Development Projects.pdf
Top Front-End Frameworks For Your Web Development Projects.pdf
 

Recently uploaded

From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .Alan Dix
 
So einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdfSo einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdfpanagenda
 
[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality Assurance[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality AssuranceInflectra
 
Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...Farhan Tariq
 
Decarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a realityDecarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a realityIES VE
 
What is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfWhat is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfMounikaPolabathina
 
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...Alkin Tezuysal
 
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfLoriGlavin3
 
Potential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and InsightsPotential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and InsightsRavi Sanghani
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxLoriGlavin3
 
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyesHow to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyesThousandEyes
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.Curtis Poe
 
Modern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better StrongerModern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better Strongerpanagenda
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxLoriGlavin3
 
Generative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdfGenerative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdfIngrid Airi González
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxLoriGlavin3
 
Emixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native developmentEmixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native developmentPim van der Noll
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteDianaGray10
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxLoriGlavin3
 

Recently uploaded (20)

From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .
 
So einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdfSo einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdf
 
[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality Assurance[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality Assurance
 
Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...
 
Decarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a realityDecarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a reality
 
What is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfWhat is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdf
 
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
 
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdf
 
Potential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and InsightsPotential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and Insights
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
 
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyesHow to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.
 
Modern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better StrongerModern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
 
Generative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdfGenerative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdf
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
 
Emixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native developmentEmixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native development
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test Suite
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
 

Client side performance compromises worth making

  • 1. Client Side Performance Compromises Worth Making Sydney Web Apps Group: 19.9.13 @cathyblabla
  • 2. What!!? Good client-side performance really is simple - smaller files, fewer HTTP requests, less DOM manipulation. Use YSlow and understand the rules it is based on. OK, so there are lots of tricky details that we could go into, like CSS selector performance, but is your site huge enough for things like that to make a difference? Probably not. So….
  • 3. Where to draw the line Where do you draw the line between good performance and maintainability? Class names like ‘a1’ to make your CSS files smaller? No way! But there some situations where ‘The Rules’ can and should be bent...
  • 4. Multiple sprite images Sprites allows us to download all our image assets in one request. If you use Compass, it’s sprite functionality makes this super simple. But all those disparate colour palettes add up, resulting in either a big 32bit PNG or degraded colour reproduction. The solution? Split up your sprites into similar colour groups and stick to a set pallette. It’s a few more HTTP requests but worth it.
  • 5. Like this... $green-sprites: sprite-map("sprites/green/*.png"); $grey-sprites: sprite-map("sprites/grey/*.png"); %mail-icon { background: sprite($grey-sprites, mail) no-repeat; &:hover { background: sprite($green-sprites, mail) no-repeat; } }
  • 6. Scaling images in HTML Ideally, we would only download images at the exact size they will be displayed, but your responsive site will probably call for fluid images to cater for different devices - what to do!? If you can, serve different sized images based on device categories then allow CSS scaling to take over.
  • 7. Choose image sizes that match your target devices closely and that are close to the upper end of your breakpoint to minimise image degradation. Include the served image’s width and height in your html to reduce the visible effect of reflows once your image is loaded.
  • 8. Load (most) scripts at the bottom of the page Inserting scripts at the end of your page stops script downloads from blocking the rest of your content. But long pages can result in a noticeable lag for script effects - while your overall page load time may be improved the users’ perception of load time could be affected.
  • 9. ...so should I load my scripts in <head> after all? One approach is to load your ‘must have’ scripts in the head, then load the rest at the bottom of the page. While this introduces some maintenance overhead, your page loads as fast as possible while also giving your users a seamless experience.
  • 10. Script loaders FTW! RequireJS is a script loader that present a unique solution to this problem. Out of the box, RequireJS loads modules asynchronously as they are called for. There is also an optimisation tool that provides an automated build. All the files required for your project are minified and concatenated, this file is then loaded asynchronously. Your scripts are optimised, available earlier and are non- blocking. Yay!
  • 11. What about lazy loading? It is possible to squeeze even more performance out of your Require scripts by splitting them up and lazy loading those that are less often needed. Read about it here. YUI includes a script loader that is based on RequireJS but also utilises a server side combo handler that serves back separate files in one request. The combo loader is open source and you can get it here.
  • 12. Some OO in your SASS Love the modular approach of OOCSS but don’ t like your HTML getting cluttered up with non semantic class names? With SASS you have the tools to write modular, concise code that can be constructed in any way you wish. Create a structural hierarchy within your SASS code and push design complexity back to the style layer to keep your HTML simple and readable.
  • 13. Use placeholders to create re-usable structures... %btn { @include rnd( 3px ); border: 1px solid grey; cursor: pointer; line-height: 2.3; padding: 0 17px; text-decoration: none; } .my-button { @extend %btn; color: green; }
  • 14. Build up top level rules from combinations of re-usables .news-module { @extend %media-block; @extend %media-module; .top-stories { @extend %stories-list; } .more-link { @extend %btn; } }
  • 15. Mixins give you more flexibility... @mixin button ($colour: green) { @include background-image( linear-gradient(white, $colour) ); border: 1px solid darken($colour, 40%); color: 1px solid lighten($colour, 20%); } .delete-button { @include button(red); } .active-button { @include button(blue); }
  • 16. But be careful of the final output... Placeholders generate a single rule with all selectors combined. If you have too many, IE goes kaboom! .btn1, .btn2, .btn { //styles extended from %btn } Mixin styles are repeated wherever they are used, so use them minimally, ideally for styles that are unique (ie, based on a parameter).
  • 17. .delete-button { background-image( linear-gradient(white, red) ); border: 1px solid #660000; color: 1px solid #FFBFBF; } .active-button { background-image( linear-gradient(white, blue) ); border: 1px solid #000066; color: 1px solid #99CCFF; }