Neil Turner's Blog

Blogging about technology and randomness since 2002

Speed Improvements

Not only is my mail client now speedier, but this site should be too. I’ve decided to dump the code that serves up the main page as XML in Mozilla, partly because it slows the page down, and partly because if I make even the tiniest mistake in my code, the whole page goes belly up. Too much trouble to be worth it, in my opinion.
Secondly, the entry and archive pages are no longer served up as PHP, and are now static HTML. That means they don’t require preprocessing on the server so they should appear immediately. It should also make my host happier because I’ll be utilising less of their CPU cycles :).

5 Comments

  1. Why does it slow the page down? Does Mozilla give up on incremental rendering when it uses the XML parser?

  2. You can’t serve an XHTML 1.1 page as text/html.

  3. Jesse – it slows the page down because I have to use PHP to decide whether to serve it up as XML or HTML. If I forcibly served it as XML, then IE would not take it, so I had to add a conditional statement that would serve an XML page if the client supported it, otherwise it would serve it as HTML. That would, at least in theory, slow it down.
    Alex – I am aware of that fact, see this post. Unfortunately, practicality wins over here.

  4. If you changed the archives from php to html what did you do for your old urls? Did you use .htaccess to redirect php requests to html? I was thinking of doing this but don’t want to break all those links (again!)

  5. Andy – I’d changed the .html extension in the .htaccess file to act as a PHP page – indeed the index page for this site is index.html but it is still run through the preprocessor. All I had to do was tell Apache that I wanted the .html files in /entries/ to be treated as HTML and not PHP. No renaming necessary :).