DUK's Performance Tuning Guide for Atahualpa

From the author of Atahualpa, the #1 mostdownloaded (700,000+) theme @ wordpress.org

#1

Feb 3, 2012, 06:02 PM

Duk

2 posts · Feb 2012

DUK's Performance Tuning Guide for Atahualpa

Hi folks!

First of all I'd like to give a big CONGRATULATIONS and THANK YOU to the creators of this theme. I'm really happy with it. My intention with this post is to increase the performance of Atahualpa not to criticise it at all. I can't imagine how hard is to maintain a big theme like this.

I'm going to create a guideline to increase the performance for Atahualpa and Wordpress (loading time, cpu usage, bandwidth reduction, minimise HTTP requests, cache, etc..). I'll be adding here any tweak of yours if you want to contribute.

This is purely based on my experience (so I could be wrong in some concepts). I've been using Atahualpa for a while, and after creating a couple of blogs with this fantastic theme I've realised that a simple page, with almost no pictures and text was taking too much time to load (close to 2 secs). After many hours spent reading and tuning I can tell you that the performance can be increased A LOT with a few adjustments, I've managed to reduce at least half time loading time on my blogs, much less CPU and server requests.

Enough with the talking, let's go to work.

As date of this post I'm using Atahualpa 3.7.3 and Wordpress 3.3.1 on an Apache 2.2.3 with PHP 5.5.3

NOTE: This guide is better to apply it after you are done with the major designs of your site. Otherwise you'll have to repeat some of the steps again and again.

0st Step - BACKUP BACKUP BACKUP!!!

Create a FULL BACKUP of your site, just in case you mess with something you shouldn't.
This means all of your files and SQL Databases.

1st Step - Install Firebug

This is a very good plugin for Firefox to check the performance of a website.
Install it so you can understand some concepts I'm going to explain in the following steps, as well you can measure how long it takes to load your website right now, even better take a screenshot so you can compare the results after doing all this tweaks. Don't forget to post your results!! https://addons.mozilla.org/en-US/fir...rch/?q=firebug

2nd Step - Get rid of ?bfa_ata_file=css and ?bfa_ata_file=js

This only applies if in ATO -> Configure CSS & JS you are using EXTERNAL for CSS or JAVASCRIPT.
If you're using Inline this requests should not appear. (I recommend to use External for SEO matters and personal preferences).

This two requests are simply the Javascript and CSS files Atahualpa creates as result of your configuration in any ATO options.

There are two main problems for each of this requests:
- First it creates extra HTTP requests, and we want to minimise them at maximum to increase page load speed.
- Second is a dynamic request, it means that everytime you switch page, this JS or CSS gets parsed through PHP and gets created again, this creates A LOT of waiting time and takes HUGE CPU resources.

We will minimise the HTTP requests at the end of the Guide, for now we're going to offload some CPU resources creating a static JS file and a CSS file, so it doesn't need to be created everytime an user clicks in any of your links.

Done! Check Firebug and be surprised how quicker is loading your site now.NOTE: Every time you make a design change in ATO, you'll have to create a new mystyles.css from the link on step 2.1 and upload/overwrite your current styles.css

If you check Yslow, you'll see another JS that's being loaded in every single page of your site: that is comment-reply.js

This JS it comes with WP, and as you can guess it allows you to leave a comment on your blog/site.

There is two main reasons to get rid of comment-reply.js:
- If you are using WP+ATA to create static sites like me, this JS is totally unnecessary as I don't use the comment system at all.
- Save bandwidth and HTTP requests, calling ONLY this JS where is needed. There are many blogs where is not possible to comment on the main landing page, so why do we need to load this JS there?

We are going to modify header.php and functions.php to create a dynamic call, so we'll load this Javascript only when there are comments allowed on the page.

3.1 step

Modify header.php, in line 40 aprox, delete or comment the following code:

3 END
If you followed the steps correctly, now you'll have 1 less HTTP request for comment-reply.js on the pages that comments are not needed, saving us bandwidth and increasing loading speed!

4st Step - A couple less database queries

There is not a lot of saving with the tweaks of this particular section, but as I'm a tuning paranoid I really want to get rid of unnecessary queries and loads. We're going to get rid of two lines on the header that are created dynamically every single time and they never change, so we're going to change the PHP query with a static line.

4.1 step

Go to your site with the navigator and open the source code of the page.

Look and note downthe 3rd and 5th lines aprox, you will have something similar like this (varies depending some local parameters):

4 END
With this tweak we just saved two queries to be being parsed on and on everytime someone visits any of your pages/posts.
Some of you may think it doesn't make such a performance difference, I partially agree on this, but this is the DUK's PERFORMANCE GUIDE FOR ATAHUALPA, and every bit and resource saved counts!

To be continued

Last edited by juggledad; Mar 2, 2012 at 06:09 AM.

#2

Feb 4, 2012, 02:28 PM

juggledad

22,658 posts · Mar 2009

OSX 10.10.1 WP 4.x Atahualpa(all) Safari, Firefox, Chrome

Note: in step 2.1 Becareful with the name of teh file. There is a style.css file and you are creating a styles.css

DO NOT NAME IT style.css and put it in the theme folder replacing the one that is there. If you do, you will BREAK the theme and at best, revert to Twenty-ten or Twenty-eleven - at worst your site may not work.

A better idea is to create a new folder in the 'wp-contents' folder - call it 'ata-manual-style' - and put the new files there. (technically, you can put it in the Atahualpa folder, but only if you copy the comment lines at the begining of the original file to the begining of your new styles.css file)

Quote:

Note for the creators of Atahualpa: I've read in the some posts that in the next big release you're going to add an option to automatice this steps, can you confirm it please? If so, for which month is the next release more or less? I'm asking this because I could make a script to do this, but if the next release is coming soon I don't think that is necessary to do it.

The post you are refering to was only made two days ago. This is not a planned addition, but I thought it was a good idea and will pass it onto the delevloper as an enhancement request.

I've noted your comment about the confusion that can lead the name style.css, so I've modified the guide and now we're going to name it mystyles.css and myjscript.js and put it in the root of the webserver, not in the atahualpa folder. That's of course a personal preference, those files can be anywhere.

I think as well that it could be a great feature to perform this actions inside ATO instead of manually doing them, so thank you again for letting know the developer about this enhancement.

About the quick test we can agree that maybe there is not much of a gain (for various reasons) but absolutely there is a gain.
On my non-stressed at all VPS server I could see a huge difference before and after the tweaks on this section, those two request were always the ones being with more "waiting" status on Yslow, because of the PHP parsing.
Please note that the tests you're doing are locally and you could see some gain, imagine in a shared hosting how much % can be scaled this gain.
As well, as I'll explain later in this guide, those two external .css and .js files now can be combined in a single file with any other JS or CSS file you're using on the site + caching (that was not possible to do with the PHP parsing) so this will lead to less HTTP requests, and gaining load page speed.

#5

Feb 6, 2012, 05:08 AM

juggledad

22,658 posts · Mar 2009

OSX 10.10.1 WP 4.x Atahualpa(all) Safari, Firefox, Chrome

The suggestions given here will make the theme run faster, however you must remember that not everything is controlled by the theme. Many plugins add there own CSS or jscripts into a generated page.

Each plugin you add, causes a longer execution path which takes more time.
The size of an image can effect load time - the bigger the file size of the image, the longer the load time
The number of post on a page will effect load time
If you are using an Adsense plugin, the speed the ad is server from the Adsense server will effect load time.
If you grab an image from another site, that will effect load time
The number of other sites on the server you are using, how active those sites are, your Internet connection speed, the load on your ISP, the speed of your computer, how much memory the server has, how much memory your computer has, how many other programs you have running on your computer.

All of those items (and probably more) will effect the performance

So you can do some things to speed up the theme, just remember it is just one piece of the picture