From cb98544ed1fe76e62823a9397087433215f8f3f2 Mon Sep 17 00:00:00 2001 From: Jorge Costa Date: Fri, 14 Oct 2022 10:45:23 +0000 Subject: [PATCH] Global Styles: Improve performance of WP_Theme_JSON::get_merged_data method. In the WordPress 6.1 cycle, WP_Theme_JSON_Resolver::get_merged_data method has become a hot path that is called many times. By improving small things that are repeated multiple times, we get more performance wins. This commit reduces the number of calls of the low-level WP_Theme_JSON->merge method, with the corresponding performance improvements. Props oandregal, aristath, mukeshpanchal27. See #56467. git-svn-id: https://develop.svn.wordpress.org/trunk@54517 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-includes/class-wp-theme-json-resolver.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/wp-includes/class-wp-theme-json-resolver.php b/src/wp-includes/class-wp-theme-json-resolver.php index 993543a55b..18b997561c 100644 --- a/src/wp-includes/class-wp-theme-json-resolver.php +++ b/src/wp-includes/class-wp-theme-json-resolver.php @@ -548,8 +548,7 @@ class WP_Theme_JSON_Resolver { _deprecated_argument( __FUNCTION__, '5.9.0' ); } - $result = new WP_Theme_JSON(); - $result->merge( static::get_core_data() ); + $result = static::get_core_data(); $result->merge( static::get_block_data() ); $result->merge( static::get_theme_data() );