After yesterday's post about me having issues with load speed times at 3.2 seconds; I have done some research for optimizing my WordPress blog. There are many blogs that have talked about this so I will be quoting some that I think was worth reading and even researching more into.
From my experience though to have a good successful website that loads with good time is not have too many codes, by this I mean not too many javascripts, not too many ajax settings, etc. These scripts call a JS file and have to run it. Sometimes these files can be large to make a simple animation or task. The only javascript files should be maybe an analytics system such as Google.
But what about affiliate systems and widgets, get rid of them or try to incorporate it with your website but remove or risk another js file? This website has several javascripts for PPC ads, widgets, etc. I will have to look at certain things and see what should stay and what should go.
Another good thing to do, especially with WordPress relate blogs is to use PHP statements. You will see with certain page especially with posts on my blogs only certain things come on and certain things come off. I do this with javascript files as well, if I am not using it why load it? For example you will see an ajax poll form on the main page but you will not see it on this post or any post. I have created an if statement for the poll form to only show on the main page. Here is the code for a simple PHP if statement in wordpress:
<?php if (is_home()): ?>
This is the homepage, only show me these things, if this is not the home page....
<?php else : ?>
then show me this text and image instead
<?php endif; ?>
Very simple, there are other php looping codes which you can read about at the official WordPress loop tutorial. This is very helpful when loading specific javascript files for specific pages or sections. If you do not feel like using if statements then maybe a javascript compressor will suite you?
A javascript compressor will take all your JS files and compress them, removing white space and adjusting comments to necessarily load at a faster rate. Here are 2 websites that are good java compressors that I use: java compress 1 or java compress 2.
Gstringin' with the GZip!
Since we are talking about compressions, GZip is a great way to save or reduce your page bytes. From Reaper-X Blog:
Fortunately WordPress already have a built in function to compress your webpage using GZip compression. It’s under Options -> Reading .. and of course if your site visitor using a gzip compatible browser, they can access your site much faster.
This is really great, I mean think about it for a minute, you extract big files that are zipped with WinZip or WinRar and you really receive a big file! If you use GZip to help compress your pages, users with a Gzip browser will be able to browse your website faster.
Cache it all out
When talking about speeding up a WordPress blog, I read a lot about cache. I use to use Wp Cache. I will be soon implementing WP Super Cache. These are great plugins for WordPress websites and blogs. But what is Cache? Cache is a web browser or web server feature which stores copies of web pages on a computer's hard disk. It will alternatively store n image of my website on your computer. This will help with repeated visits.
Simon explains cache into more details especially with optimizing with Wordrpess:
...Wordpress comes with an inbuilt caching mechanism, to stop the datbase being hit so often. By itself, this may not benefit you too much, but I’d say enable it anyway by adding the line of code below to your wp-config.php file:
define(’ENABLE_CACHE’, true);
4.) Proper Caching - this is more advanced, but it works amazingly well. If you’ve ever had problems with slow loading times and stretched resources, you should try out this plugin. It may take some playing about with if you want to keep parts of your site dynamic...
With that said having a cache system is great and is beneficial for you the author and me the reader. Another topic that is touched upon is plugin use. Recently I posted my new list of plugins, which IanFernando.com uses. Maneesh commented there is a whole lot of plugins that I am using. Are they all being used? Yes. Are they beneficial? Yes. But for the plugins that are not being used I typically removed them from my plugins folder.
Does removing unsed plugins really help the speed of your WordPress blog? I do not think so, since they are not activated. I have read from other blogs, to remove unused plugins from your plugins directory. I do this, but I do not think it plays a role in the load time because again, it is not activated or loaded. But, some plugins are not well written and may cause an issue with access to the database. Try to find well known or popular plugins to assure the quality of the script.
Image Load Time
Another issue which causes a webpage delay are the images. Images can cease a website load time or make the layout look inaccurate. Yesterday's post about the guru's load time prove that images does play a role in the response of a website. From yesterday's pingdom graphs Shoemoney's graphics were taking a tole on his load time. Try to choose images that are easy for loading. Also do not resize the image from its actual size. When I say resize do not adjust the actual width and height of the image, but resize the actual pixels of the image. There are multiple image re sizers that are free you can even find some online!
Conclusion
Load times for a website can determine if a user wants to continue to read your website after a long load time or not. We are in the digital world and everything comes at use fast, especially websites on a cable or dsl modem. We expect FAST! So if a specific website is not loading to our needs and standards we simply just ignore it without giving it a chance. The website maybe even have great content but a new user may not realize that if it will never load. So that is why I was a little annoyed with just over 3 second load time, but what number is perceived as a good load time?