Articles, Tutorials

Better WordPress profiling with xhprof and $ignoredFunctions

Are you profiling your WordPress-based web application/site with xhprof? Go read my other article about how to install and configure xhprof profiler with WordPress. Even if you are already familiar with xhprof, there is a small but important problem: the profiling results are unnecessary bloated.

Figure 1:  Bloated Expensive Calls Chart

Figure 1: Bloated Expensive Calls Chart

Figure 2:  Bloated table

Figure 2: Bloated table

See what I mean?

What are these?

  • ()main
  • op_???
  • call_user_func_array
  • do_action
  • etc

Is it really important for us to know that a function going by name do_action takes 800 milliseconds of a site’s loading time? What about call_user_func_array? Well, no, not even a little bit. These general WordPress/PHP functions tell us nothing valuable.

Put them on the $ignoredFunctions list

The solution is straightforward. Open the xhprof’s config.php file and look for $ignoredFunctions variable. It was commented out in my case. Uncomment it and add names of the functions you want to hide from the chart and table there. Fore example:

$ignoredFunctions = array(
     * Ignored functions for WordPress sites

Now we get a much nicer overview of what is slowing our site down!

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s