I think we can really overhaul our codebase. I currently have a test
server at home, running a Smarty version of the site. Caching isn't
implemented yet, but it should be pretty simple to do (add a bit to enable
cache on the smarty object, some logic to force recaching on update).
Comments page: We could basically almost ONLY serve cached version of the
- Set the caching to keep a cached version for an infinite time
- Every time someone posts a comment, flush the cached version.
- On page request, check if there's something in the cache, and serve
that. If not, rebuild the page.
We'd build a custom smarty function to do that, and we'd then just have to
include it in a template. That means that a 750 comments threads would
require, all in all, 1500 database queries. And archives would become, in
essence, static pages.
We could do the same thing with the front page and archives. For
anonymous, the front page would be updated every time a post is
made/deleted or every 5 minutes, whichever happens first. It's a little
more complicated for logged in users because of the (X new comments)
thing, but not much.
Going for Smarty has the added advantage of losing the Ad Hoc parser Jack
built, which probably accounts for a bit of CPU usage. Also, the
log-in/check if user is there code needs some major overhaul: it's all
over the place, and has me hopelessly confused.