Make WordPress Core

Changeset 54517


Ignore:
Timestamp:
10/14/2022 10:45:23 AM (21 months ago)
Author:
jorgefilipecosta
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/class-wp-theme-json-resolver.php

    r54501 r54517  
    549549        }
    550550
    551         $result = new WP_Theme_JSON();
    552         $result->merge( static::get_core_data() );
     551        $result = static::get_core_data();
    553552        $result->merge( static::get_block_data() );
    554553        $result->merge( static::get_theme_data() );
Note: See TracChangeset for help on using the changeset viewer.