29 Validation Errors!

Date Icon Posted on Saturday 29th April 2006 @ 3:35pm BST

Last week I switched the database code behind the website with a newer improved version I had written. I also thought about how to speed up the website a little because it was quite in-efficient. If someone hit the home page for example, it would extract 10 of the latest blog entries from the database and scan each entry for bad characters, swapping them with good characters and displaying the blog entry. As I was scanning for 20 or so bad characters that’s 200 iterations being done on the fly whenever anyone requests the home page!

Ok, so it didn’t take much time to process because each blog entry is only about 250 words and the site is being hosted on a super fast webserver but I wanted to speed everything up as much as possible. What I decided to do was do all my scanning, replacing and HTML validation fixing when I posted an item rather than on the fly when the items where being displayed. Once I implemented the changes it all worked rather nicely with a 25% speed increase :)

It was only this morning when I decided to do some XHTML validation on my site that suddenly I realised my home page was littered with 29 errors! I had forgotten to remove the <p></p> tags from the home page template but remembered to insert them into the database. Anyway I’ve fixed it now and the website is running along nicely with a 25% speed increase :)