You may have noticed it doesn’t take as long for a comment to post in the last couple of days. I read something about MT and the speed of rebuilding pages at another site (don’t recall where) and in the comments there Ben Trott (one of MT’s programmers) mentioned that the slowdown seems to be a result of using the MTArchive tag a bit too much.
Well, I use it a lot and not just on some of the archive pages. For example, many of the things in the navbar to the left, such as the listing of links to the monthly and category archives, make use of the MTArchive tag to create them. That side bar is on the main index page as well as the individual entry pages and the category archive pages as well. I was originally including it using MT’s built-in template module system and that means that every time a comment was posted or an entry was added it was processing those MTArchive tags a minimum of 5 times for every page that needs to be updated.
The solution? I created a new “index” template that contained the code for only the sidebar and then import that into the various other templates using PHP’s include statement. Now those tags are processed once for all the sidebars instead of repeatedly for each page that uses them. The other advantage is that the sidebar is now consistent across all pages (it used to do different things depending on the nature of the page it was being used on). Honestly, I don’t know why this didn’t occur to me sooner as in hindsight it makes perfect sense. SEB is still no speed-demon, but it’s definitely faster than it was.