Willem Grooters wrote about PHP performance recently, which got me thinking about the PHP script behind my Code examples page.
The script is really there for convenience, just so I don't have to maintain a page for each example that has all the bits and pieces that make up the look and feel of the website. Additionally, the script does a bit of text highlighting, and it replaces the names of the run time library routines with links to the documentation. As the files don't change very often, it would be nice to generate a static file for performance.
So I started researching, and the easiest way that you can achieve this in PHP is with caching. In particular, I came across PEAR Cache Lite, which made short work of adding caching to the script.
The cache has an infinite lifetime and is only invalidated if new or modified files are uploaded to the site.
This reduced the length of page loads on the script from about 5 seconds to less than half a second.
Although it doesn't appear that PEAR is available on OpenVMS, doing simple PHP caching is pretty straightforward, and perhaps Willem could benefit from a scheme like this.
Posted at July 24, 2013 12:33 PMComments are closed