Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
get_merged_data: start from an existing theme.json
get_merged_data is now a hotpath that is called many times.
By improving small things that are repeated multiple times
we get more performance wins.

Instead of starting with an empty WP_Theme_JSON and call the merge operation
we start by using the existing WP_Theme_JSON from core.

This reduces from 402 to 326 the number of calls of the low-level
WP_Theme_JSON->merge method.
  • Loading branch information
oandregal committed Oct 14, 2022
commit 0c676f363b19fb1d1196c263e363f42193081b86
3 changes: 1 addition & 2 deletions src/wp-includes/class-wp-theme-json-resolver.php
Original file line number Diff line number Diff line change
Expand Up @@ -548,8 +548,7 @@ public static function get_merged_data( $origin = 'custom' ) {
_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() );

Expand Down