How to check speed of separate function in wordpress

Any developer of theme or plugin on php sometimes needs to check speed of custom function or even a part of code. Here simple solution. 

By default, wordpress has some functions to check speed of overall database queries and number of queries.

Code for this

Place this code in footer and you will  see memory and queries count. But what if you want to check speed only for one function or part of site. For example, you want to compare speed of different functions. This genius code will help you

Place before function or code

Place after function

This will show you speed of your function in microseconds.


We will be happy to hear your thoughts

Leave a reply

Wordpress optimization, monetizing tips and tricks