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.

 

How to check speed of separate function in wordpress
3.33 (66.67%) 6 votes

Want to get unique wordpress tips?

We won't rent or sell or spam your email. We promise!

Leave a Reply

Be the First to Comment!

Notify of
avatar
wpDiscuz