Skip to content

Enhance performance of _add_block_template_part_area_info()#3975

Closed
felixarntz wants to merge 1 commit intoWordPress:trunkfrom
felixarntz:enhance/add-block-template-part-area-info-performance
Closed

Enhance performance of _add_block_template_part_area_info()#3975
felixarntz wants to merge 1 commit intoWordPress:trunkfrom
felixarntz:enhance/add-block-template-part-area-info-performance

Conversation

@felixarntz
Copy link
Copy Markdown
Member

This PR optimizes performance of _add_block_template_part_area_info() by only computing the most expensive logic once for all template parts, instead of doing it for every template part individually on request.

Trac ticket:


This Pull Request is for code review only. Please keep all other discussion in the Trac ticket. Do not merge this Pull Request. See GitHub Pull Requests for Code Review in the Core Handbook for more details.

@felixarntz
Copy link
Copy Markdown
Member Author

After giving this a performance benchmark, it shows there is a consistent improvement in performance of this function. However, the benefit is so small that making this logic change is probably not worth it.

  trunk with PR
function total time 3.85 3.36
function call count 6 6
WP total time 191.88 193.73

Data based on medians for 20 requests.

There is still a bottleneck here somewhere that we should probably find a way to address to make the overall time it takes to get the template parts faster.

@felixarntz
Copy link
Copy Markdown
Member Author

cc @spacedmonkey for visibility

This optimization helps a tiny bit, but not really worth doing. Just wanted to let you know I gave this a try :)

@felixarntz felixarntz closed this Feb 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant