[wp-trac] [WordPress Trac] #59178: Performance optimization of wp_get_block_css_selector()
WordPress Trac
noreply at wordpress.org
Wed Aug 23 15:53:48 UTC 2023
#59178: Performance optimization of wp_get_block_css_selector()
-------------------------+-------------------------------------------------
Reporter: mukesh27 | Owner: (none)
Type: enhancement | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Editor | Version: 6.3
Severity: normal | Keywords: needs-patch has-screenshots good-
Focuses: performance | first-bug
-------------------------+-------------------------------------------------
On the TT3 home page, a single post with content (including an image and
text) is causing calls to the `wp_get_block_css_selector` function during
testing. This function call occurs 567 times, which is significantly
impacting performance. A deeper analysis reveals that the `array_merge`
function is being called 372 times within the `wp_get_block_css_selector`
function, leading to unnecessary overhead.
According to measurements taken using the XHProf tool, these activities
are consuming approximately 2% of the total load time for the page.
Addressing this issue has the potential to not only enhance performance
but also contribute to improved memory management, as demonstrated in the
attached screenshot.
Additional props to @joemcgill for helping to identify the bug!
--
Ticket URL: <https://core.trac.wordpress.org/ticket/59178>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list