Optimizing WordPress Performance with P3

Share this article

P3 (Plugin Performance Profiler) is an extremely handy free WordPress plugin. It captures information on all of the plugins installed on your WordPress website, and then it measures, reports on, and visualizes their impact on the loading time of your site.

While the WordPress Plugin Directory is one of the biggest assets to the WordPress community, the truth is that some plugins can negatively impact the performance of your site. Plugins that are improperly configured, misused or poorly developed can hurt your site and, in some cases, slow it down to a snail’s pace. Luckily, P3 can quickly and easily pinpoint WordPress performance issues, help you test ways to make your site faster, and troubleshoot problematic plugins.

As web professionals, we are constantly faced with the challenge of optimizing a growing range of technologies, including richer content, and media designed for various devices and higher resolutions. As we strive to meet these challenges, performance (and performance monitoring tools like P3) become increasingly important.

About P3

P3 was developed by Kurt Payne, a PHP developer at GoDaddy and a WordPress core contributor. P3 has been downloaded 266,502 times (as at the time of writing). It has a 4.6 star rating, was last updated just a week ago, and 14 out of 15 support threads have been resolved in the last two months.

P3 works by monitoring the PHP function calls that WordPress makes when serving pages. It’s packed with an assortment of useful features, and deserves a place in the toolbox of every WordPress user and developer.

How to Install P3

P3 is simple to install: use the same process as you would for any other WordPress plugin:

  1. Open your WordPress Dashboard
  2. Click on Plugins
  3. Click on Add New
  4. Enter P3 into the search box
  5. Click on Install Now on the P3 Plugin Performance Profiler result
  6. Activate P3

You can also manually download the P3 plugin here

Once P3 is installed and activated, you will be greeted with something that looks like this:

P3 Installed

Performing a Scan

To perform a scan, all you need to do is click on the ‘Start Scan’ button. You will then be presented with two options:

  • Auto Scan: this option runs an automated scan of your website.
  • Manual Scan: this option allows you to browse selected pages within your website, undertake your own performance testing, and stop the test at any time you like.

Auto Scan

This is a quick and easy, simple option. Most of the time, an auto scan will detect any nasty issues. The downside to this type of scan is that it treats you as logged in, which may not be ideal.

Manual Scan

This option gives you much greater control on what you’re testing. Once you’ve selected the Manual Scan option, all you need to do is visit your site and, provided that you’re visiting from your IP address, P3 will start collecting data.

It’s worth mentioning that you might want to open another browser or an Incognito tab/window and browse your site from there. This way, you can test your site as a regular user, not as a user logged into the Dashboard.

There is an option (under Advanced Settings) to configure this IP address (or additional IP addresses). However, by default, this is set to your IP address.

Scanning Specific Pages

You can also configure P3 to scan specific pages only. This is particularly useful if you’re troubleshooting one area of your site, like a shopping cart or an image gallery.

To specify URLs to scan, add the following to your functions.php located in your theme directory.

function my_p3_auto_scan_pages() {
    return array(
        'http://www.example.com/',
        'http://www.example.com/foo/',
        'http://www.example.com/foo/bar/',
    );
}
add_filter( 'p3_automatic_scan_urls', 'my_p3_auto_scan_pages' );

Scan Results

The results generated by P3 are very straightforward and presented quite intuitively. The image below shows the results of a scan.

P3 Scan Results

Most of the time, especially if you’re troubleshooting a performance issue, you’ll see a problem plugin stand out like a sore thumb. At a glance, you’ll also be able to see:

  • The total number of plugins installed on your site
  • Plugin Load Time
  • Plugin Impact
  • MySQL Queries per visit

These results will vary from site to site. There isn’t a hard and fast rule for a ‘target’ to aim for. The main thing is that you establish a baseline. The lower that all these numbers are, the better. Lower numbers generally mean quicker loading times for your website visitors. Kurt Payne has posted a good answer to this question at the P3 Support Forum.

P3 Scan Results

The Scan Results tab displays the most important data, but there are also quite a few nifty features that you may not notice at first glance, including:

  • Timelines
  • Scan History
  • Advanced Metrics
  • Email Scan Results

Timelines

There are several views that you can use to drill down into the results of your scans. The Detailed Timeline is definitely worth looking at. Below is a simple example.

P3 Timeline

Scan History

Scan History is an online archive of all your plugin performance tests. It allows you to view old scan data, and compare it to new results, so that you can track plugin changes over time. It is not uncommon for plugins to run perfectly when first installed, but struggle as time goes by, particularly when dealing with more requests/data or as server resources change.

P3 Scan History

Advanced Metrics

Advanced Metrics provides several visual views of your test results, including data on total load time, site load time, profile overhead, memory usage, margin of error, and MySQL queries.

P3 Advanced Metrics

Email Scan Results

As the name suggests, Email Scan Results allows you to email scan results directly out of the WordPress Dashboard, and into your inbox or share it with your team with just one little click.

P3 Email Scan Results

How Accurate is P3?

Given the very nature of what P3 is measuring, and the way in which this measurement is undertaken, P3 cannot possibly be 100% accurate. Results can, and do, change between scans. Numerous factors can affect the results of a P3 scan: the server environment, website traffic fluctuations at the time of scanning, activity in the plugin itself, and other activity on your server. Caching can also affect tests.

However, you can view the margin of error in the Advanced Metrics section. Numerically speaking, the margin of error is relatively low.

The best way to ensure the most accurate results from P3 is to run more scans. The more scans you run, the better. Don’t assume that the results from one or two scans are 100% reliable.

Conclusion

P3 can be a useful tool in testing plugin performance, and the impact that plugins are having on your WordPress website. Used as a guide, P3 can help you pinpoint potential problems and keep your website running quickly and efficiently.

If you’re interested in learning more about WordPress performance optimization, check out our recent article How to Speed Up WordPress.

For more information on P3, visit the P3 project page at the WordPress Plugin Directory.

Chris BurgessChris Burgess
View Author

Chris isn't afraid to admit it: he's a geek from way back, having worked in IT for more than 20 years. He co-founded a digital agency called Clickify, working with a great team of developers and marketers, and is also the WordPress Editor for SitePoint. Chris is passionate about keeping up-to-date with the latest web technologies and can be found at many of the tech events in Melbourne, Australia. For more details, check out his personal site at chrisburgess.com.au.

ChrisBp3performanceperformance-toolspluginpluginsWordPress
Share this article
Read Next
Get the freshest news and resources for developers, designers and digital creators in your inbox each week