Tech Note: Optimizing LGF Pages
I’ve been doing a lot of work on the LGF Blog code behind the scenes, so as always, if a feature doesn’t seem to be working correctly, the first thing to try is reloading the page. Bugs get fixed quickly, so reloading will often make all your problems disappear. Well, not all your problems, just the LGF page loading ones.
A significant improvement that isn’t visible in terms of any flashy new features or icons: the size of the front page has been decreased by about 30K, by using Ajax to load all those “spinoff links” forms the first time someone clicks the link, instead of every time the page is loaded. This way, all of that HTML code is loaded only as needed; since there are usually 25-30 posts on the front page, this results in a significant weight loss achievement.
I don’t know if you’ll see a visible speed difference in loading the front page; that depends on a whole lot of other factors besides the page size. But the server hamsters always thank me when I command them to do less work.
In addition to the spinoff links improvement, I’ve greatly reduced the size of the JSON messages that get passed back and forth from your browser to our servers when you post a comment, click the “new comments” button, or turn the “auto” feature on. This also greatly pleases the hamsters.
As always, a big plug for the jQuery JavaScript Library, upon which LGF relies. I’ve finally started using the latest version again, after solving one of the problems that was preventing me from upgrading.