Top Banner
Chris Davenport Template tuning for high performance Website performance optimisation for Joomla template developers
33

Template tuning for high performance

Sep 01, 2014

Download

Technology

Chris Davenport

Presentation given at the J and Beyond conference on 31 May 2010.
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Template tuning for high performance

Chris Davenport

Template tuningfor high performance

Website performance optimisationfor Joomla template developers

Page 2: Template tuning for high performance

Web developerClickingmad Limitedwww.clickingmad.com

Joomla Leadership TeamProduction Working GroupDocumentation Coordinator

About me

Page 3: Template tuning for high performance

Tools to measure performance

Optimising JavaScript

Optimising CSS

Optimising images

Optimisation process

Quick overview

Template tuning for high performance:Optimisation for Joomla template developers(not looking at things like PHP, SQL or server optimisation)

Page 4: Template tuning for high performance

+500 ms -20% traffic @ Google

+100 ms -1% sales @ Amazon

Performance matters

Page 5: Template tuning for high performance

Google takes site speed into account

Page 6: Template tuning for high performance

You can't manage control what you can't measure

What tools should you use?

+

Page 7: Template tuning for high performance

Using the Firebug Net Panel

Page 8: Template tuning for high performance

Using YSlow

http://developer.yahoo.com/yslow/

Page 9: Template tuning for high performance

This is the only time whereJoomla Is directly involved

80% of the time to render a pageis waiting for files to download

Web page timeline

c. 20% c. 80%

Page 10: Template tuning for high performance

Where is www.joomla.org?

Opens TCP connection to 206.123.111.172

Request resource: GET / HTTP/1.1

Server sends requested resource back

Serverat

206.123.111.172

DNS server

Use

r' s w

eb

bro

wse

r 206.123.111.172

Anatomy of a single request

Closes TCP connection

Connection re-used

Cached

Connection re-used

Page 11: Template tuning for high performance

So, why the staircase?

Page 12: Template tuning for high performance

Optimising JavaScript

JavaScript

CSS

JavaScript blocks other browser activity

CSS

What's the problem?

Page 13: Template tuning for high performance

http://www.browserscope.org/

Optimising JavaScriptParallel download limits

Page 14: Template tuning for high performance

Expect at least 25% of visitors to havelow parallel download limits

Optimising JavaScriptOlder browsers have lower limits

Page 15: Template tuning for high performance

JavaScript here

Moved here

Optimising JavaScriptMove JavaScript to the end

Page 16: Template tuning for high performance

Optimising JavaScriptMove JavaScript to the end

Page 17: Template tuning for high performance

http://code.google.com/apis/ajaxlibs/documentation/

Make sure you requestthe right version

Optimising JavaScriptUse Google AJAX Libraries API

Page 18: Template tuning for high performance

Note: This code can be placed anywhere in the template index.php to prevent MooTools from loading.

For example, if you don't need MooTools, remove it.

Optimising JavaScriptRemove unused JavaScript

Page 19: Template tuning for high performance

Optimising JavaScriptMinify JavaScript

Page 20: Template tuning for high performance

http://code.google.com/p/minify/

Download the Minify zip file

Extract into your template root directory

Set paths in min/config.php

Set up groups of files in min/groupsConfig.php

Optimising JavaScriptMinify and compress JavaScript

Page 21: Template tuning for high performance

Modify your template index.php

Note: Minify also sets far future expiry date headers

Optimising JavaScriptMinify and compress JavaScript

Page 22: Template tuning for high performance

Optimising CSS

Consider using a Content Delivery Network (CDN)

Move CSS to the head

Remove unnecessary CSS rules

Merge, minify and compress CSS files(Minify script used for JavaScript also supports CSS)

Page 23: Template tuning for high performance

Optimising CSS

Page 24: Template tuning for high performance

Optimising images

Start downloading large images early

Consider using a Content Delivery Network (CDN)

Merge and compress image files

Serve images from a cookie-free domain

Page 25: Template tuning for high performance

Use CSS sprites

Sprites reduce the number of HTTP requestsRemoves latency when applying hover effects

Optimising images

Page 26: Template tuning for high performance

http://spritegen.website-performance.org/

Upload zip file containing images

Open-sourceWritten in PHPCan be run locally

Generating CSS spritesOptimising images

Page 27: Template tuning for high performance

Use Smush.it ™Optimising images

Page 28: Template tuning for high performance

Use Smush.it ™Optimising images

Page 29: Template tuning for high performance

Other OptimisationsContent Delivery Networks

Page 30: Template tuning for high performance

Suggested optimisation process

Create CSS sprite images

Update CSS to use the sprites and test

Crush images

Minify and compress CSS

Update template index.php and test

Minify and compress JavaScript

Update template index.php and test

Keep CSS in the head and JavaScript in the tail

During final stages of site build

At all times during development

After site has gone live

Evaluate, reflect and improve

Page 31: Template tuning for high performance

Questions?

Page 32: Template tuning for high performance

http://clickingmad.com

Page 33: Template tuning for high performance

This presentation is available for use under the

Joomla! Electronic Documentation License

http://docs.joomla.org/JEDL

Copyright © 2010 Chris Davenport