Finding Bottlenecks in WordPress Code
A few months back Iain wrote about how our team pushes each other to be better developers, which included insights into how we improve code quality using tools such as Xdebug, unit tests, and code reviews. While these tools can significantly reduce the number of bugs introduced into a codebase, they don’t always highlight more subtle issues that can cause problems further down the line, especially in regards to performance and resource utilization. In this article I want to demonstrate a few ways in which you can identify potential performance issues in your codebase, which will hopefully allow you to fix them before they become real issues. Let’s start with Query Monitor before moving onto code profiling using Blackfire.
Query Monitor
Query Monitor is a debugging plugin by John Blackbourn and it provides a plethora of useful information about the current page request, such as:
Page generation time and memory usage
Database queries performed and time taken
Slow or duplicate database queries
HTTP requests performed using the WordPress HTTP API
Hooks fired during the request and the actions attached to each hook
It also adds important metrics to the admin bar, so that you
Source: https://managewp.org/articles/13834/finding-bottlenecks-in-wordpress-code

source https://williechiu40.wordpress.com/2016/11/15/finding-bottlenecks-in-wordpress-code/