The last time I investigated the relative performance of different WordPress permalink structures, I provided a simple Gist that allowed everyone else to play along at home.

In a nutshell, I hooked in both at the top and the bottom of WordPress' [cci]parse_request()[/cci] method and captured the time it took to actually process a URL request. It was a fairly simple method, and by averaging the results of 10 runs of each permastruct I was able to get a rough picture of what was going on under the hood.

Unfortunately, the previous method was a bit short-sighted.

Limitations

Firstly, I was running my tests against a pristine installation of WordPress. There were only a handful of hand-entered posts and perhaps one or two different pages. A few readers pointed this out, so I re-ran my tests against a snapshot I had lying around of a very large WordPress installation. The results were slightly different, but still useful.

This setup isn't the most scalable thing in the world, though. It required adding a couple of hooks to WordPress, and hoping that everything would be clean enough on the inside to run quickly. Being a drop-in script meant anyone could run it. But the different installations (and the fact that output was relegated to a hidden HTML tag on a given page) make it difficult to compare results between installations.

Version 2

So this week, I've started work on a new project: PerfPress.

The overall goal of the project is to build a command-line tool that allows for testing the relative performance of different structures and functionalities within WordPress. The first component is a performance test for [cci]parse_request()[/cci].

At the moment, PerfPress will allow you to test the running time of [cci]parse_request()[/cci] for all of the standard permalink structures and a variable number of posts and pages. Like the WordPress test framework, it dynamically creates posts and pages in the database, rolling back the transaction when it's finished with the test. It also runs [cci]parse_request()[/cci] 1000 times, giving a more meaningful execution average than a mere 10 runs.

Armed with this new tool, I've re-tested the various permalink structures with 1, 10, 100, 1,000, 10,000, and 100,000 posts (and pages) in the database. The results have been pretty much what I've expected:

  • The default permalink structure is the fastest
  • The postname structure is the slowest
  • The other three permalink structures are fairly equivalent, with the numeric structure taking an slight edge

This gives me the information I need to move forward with various site changes. Hopefully new tests coming to PerfPress as time goes on will make it an even more useful tool for everyone.