My theme kinda died

And I’m not in the mood to fix it anymore. I used a heavily customized HemingwayEx ever since I started this blog, but it’s been unmaintained for the past 7 years and I noticed recently that my homepage is now all wonky. Plus sporadically people had been complaining about readability.

Since I don’t post that much anymore, I think it’s time to go to something more standard, so I just selected one of the wordpress defaults for now. Feeling cute, might change later 😀

Preparing for a long-time-coming upgrade

After squashing a showstopping bug, I’m finally ready to upgrade my theme to the newest version and hopefully jump start its development, on my own if necessary.

The Keyboard Parade
Image by theopie via Flickr

I’m finally preparing to upgrade my theme to the latest version (ie the next part in my ongoing attempts to upgrade) as I really should finally start using wordpress widgets. Unfortunately the theme seems to be unmaintained at the moment and the author MIA since April this year. Also the theme still hasn’t been moved to the shiny new official WordPress repository which tells me that Nalin must have lost all interest in it.

Hopefully I’m wrong. I’ve sent him an email and left a forum post asking to add to the repository and allow me to pickup the maintenance if he’s not interested anymore. If he doesn’t come back to me, I’ll unfortunately have to fork it in order to make it compatible with newer version of WordPress and to merge the changes I’ve made into it for others to use. We’ll see.

Some of the things I’m planning to add/modify are

  • Support for the new way of styling so that it works properly with Zemanta and builtin alignments.
  • Option to enable drop-down menus for the header (as you see above) through suckerfish and possibly superfish in the future.
  • More options to tweak.
  • Widgetize the single-post sidebar to allow some content in the generally empty area on the left.
  • Hardcoded support for the various plugins I’m currently using. So for example, if you install emo-vote, there code will already be in your theme to activate it but nothing will be visible if the plugin is missing. I will probably add support for tweaking these plugins in the options page as well.

And that’s for starters. Fortunately I see that the community around this theme is still alive so I’m guessing I’ll be getting more ideas for addition from there as well.

I’m still running my old theme since I managed to debug the suckerfish issue a few minutes before I left for work today, but now that my biggest hurdle is resolved, I’ll soon my changing into “fresh clothes” so to speak.

Reblog this post [with Zemanta]

Theme Upgrade Fail

I never understand why upgrading to the newer HemingwayEx is such a hassle. This is the second time I’ve attempted it now (once more on 1.0) and I just now gave up.

What is happening is that I get the theme to work, I can change the colours just fine and switch to finally using widgets, but for some reason I can’t get the suckerfish dropdown to work and I keep running into various other problems (like my gallery losing its theme etc).

It wouldn’t be such a great problem if I knew where to start but what is happening is making me scratch my head. Specifically, even drop-downs start to work once I put the code in, they get hidden behind the background. That is, I can see the dropdown menu appearing (the top of it) but its somehow placed behind the main content and even expanding the navigation does not make it appear. Grrr

Anyway, it’s too much bother to figure out what is causing this so I’ll stay with my current version which still seems to be working fine. I will however attempt to widgetize it and perhaps upload it as a different version from HemingwayEx. I’ve aready created a sourceforge page for it (waiting approval still) and then possibly more people might be willing to help.

It only annoys me that I spent so much time on it and I still couldn’t get it to work as the current version.

How to hunt for WordPress performance hogs

So after my previous post on how I discovered my major causes of wordpress pain, I kept looking on what is causing my other delays. Eventually, while looking at my source code, I discovered that my wordpress page was always reporting how many SQL queries it took and how long they took to complete. Looking at the footer, this was done by this command:

<?php echo get_num_queries(); ?> queries. <?php timer_stop(1); ?> seconds

Now, I understood that this was very helpful but I couldn’t understand why it was returning a time like 10 seconds when the page was loading for 4-5. A quick google search for this code however did lead me to a page that was explaining how to Keep WordPress overhead down. Through there, I realized that those seconds were some sort of CPU time taken to draw those queries.

Through this then, I now had a semi-accurate way to monitor the impact of each plugin on my site. I only needed to figure out which parts of the site were hogging down the queries and increasing the load time.

I created a quick table in a Spreadsheet and started logging down the differences.

  • First, I made the performance text visible, so that I don’t have to look at the source code each time (You can still see it by scrolling to the bottom of the page)
  • I disabled the WP-Cache so that the queries are done every time
  • I then started disabling each plugin in turn and reloading a page. Then I compared that with the previous loading time (where the plugin was enabled.) I noted down the difference in queries and the average/approximate CPU time difference.

Unfortunately since the CPU time tended to vary from load to load, I couldn’t get an accurate number of the difference. The table I made in the end looked something like this

Plugin name Queries CPU Time Taken
Bad Behaviour 1 5
Hide Text 0 Negligible
Greeklish 0 Negligible
One click install 0 Negligible
SimplePie WordPress Plugin 4 Negligible
Security Scan 1 1

After I went through all the plugins, then I started doing the same thing with my various widgets and snippets of code in my theme that might be causing this.

Once this was done, I had one likely suspect plugin and a few widgets that were probably contributing to this slowdown. You see, my theme, a very heavily hacked HemingwayEx, was using some custom widgets in order to draw from WordPress the latest comments, recent posts and whatnot. These widgets queried the database each and every time a page would load which was quite frankly impractical.

Fortunately a short time before, I had discovered the very useful bundle of post plugins. They were also there to hunt for recent comments & posts and related posts and they also included a built-in caching mechanism! As sweet as it gets.

I quickly modified my widgets to run this code instead and the results were wonderful. By disabling also the single other plugin I found that was slowing things down, Bad Behaviour, I’ve now managed to drop the loading time considerably (or so it seems for the time being). Not only that, but I’ve managed to put a few new toys to use that do a better job than HemingwayEx’s built in functionalities.

Currently my site seems to load lightning fast compared to before but I’m not absolutely convinced this will not change once my shared hosting environment gets bogged down. Hopefully, even if that happens I will still have a much much better performance than before.

I am still stuck at around 65-80 queries per page load but I can’t figure out where they come from. I am hoping that I’ll eventually be able to trace it but for now it seems enough.

Btw, I just loved the functionality of the Post Plugins to measure their own execution time and report it back to you. This is something that all plugins should be doing in order to give the web designer an idea on what is going on with his site. I’m going to work to see if I can implement that in the Lifestream plugin I’m working on and then see if I can place it on other plugin as well.

Btw (2), Can anyone explain why more people don’t take advantage of the Plugin cache plugin? I am fairly certain that a number of heavy plugins (like Popularity contest) could make good use of it.

As always, if you have any more ideas on where to look and tweak to improve my WP performance even more, I’ll be glad to hear them (AKA Whining because no one is commenting on my blog :P).

PS: It’s a pity that I had to disable Bad Behaviour as it worked quite well until now. I also don’t like to reply too much on just a single anti-spam plugin. Unfortunately, the performance hit was undeniable and I’d rather my site doesn’t take an extra 3-4 seconds to load every time.