-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Closed
Labels
[Type] BugAn existing feature does not function as intendedAn existing feature does not function as intended[Type] PerformanceRelated to performance effortsRelated to performance efforts[Type] RegressionRelated to a regression in the latest releaseRelated to a regression in the latest release
Description
Description
I'm currently trying to improve performance in WP-Core, and the thing that currently stands out as a bottleneck is the WP_Theme_JSON::remove_keys_not_in_schema method.
Posting a screenshot of a webgrind analysis below:
WP_Theme_JSON::remove_keys_not_in_schema runs 38228 times, and consumes 14.36% of resources/server-time.
Step-by-step reproduction instructions
I'll just post instructions on how I setup webgrind on my localhost using wp-env, so hopefully others can also test and debug performance issues:
- I use the https://github.com/WordPress/wordpress-develop repo, but I think the same would apply for this one. Edit the
.envfile. SetLOCAL_PHP_XDEBUG=true, andLOCAL_PHP_XDEBUG_MODE=develop,debug,profile. - Download or clone https://github.com/jokkedk/webgrind locally. I do it in
wp-content/plugins/webgrindbut all that matters is you put it somewhere you can access it from a URL. - start wp-env normally. Xdebug will now be available and profiling will run. Which also means that page-loads will be significantly slower due to all the profiling happening in the background.
- Visit your site, login, then refresh the frontend a few times. Doing multiple runs will allow you to get some more stats and you can ensure that the stats you see later are not a fluke but consistent between all your page-loads.
- Visit the URL where you copied webgrind, and examine the results. In my case that's on
http://localhost:8889/wp-content/plugins/webgrind/but it will vary depending on where you copied the files etc.
Screenshots, screen recording, code snippet
No response
Environment info
- WordPress trunk
- No plugins activated
- Happens with and without the Gutenberg plugin active
Please confirm that you have searched existing issues in the repo.
Yes
Please confirm that you have tested with all plugins deactivated except Gutenberg.
Yes
Metadata
Metadata
Assignees
Labels
[Type] BugAn existing feature does not function as intendedAn existing feature does not function as intended[Type] PerformanceRelated to performance effortsRelated to performance efforts[Type] RegressionRelated to a regression in the latest releaseRelated to a regression in the latest release
