#60749 closed defect (bug) (fixed)
Interactivity API: Avoid unnecessary processing of directives
Reported by: | joemcgill | Owned by: | swissspidy |
---|---|---|---|
Milestone: | 6.5 | Priority: | normal |
Severity: | normal | Version: | |
Component: | Editor | Keywords: | has-patch commit fixed-major dev-reviewed |
Focuses: | performance | Cc: |
Description
During performance reviews on 6.5, it was discovered that processing directives of interactive blocks can sometimes be the source of degraded performance.
This is because all block types that support interactivity are getting processed by wp_interactivity_process_directives_of_interactive_blocks
even if the block markup didn't contain the necessary data-wp-
markup necessary for processing, resulting in unnecessary calls to wp_interactivity_process_directives
which make heavy use of the WP_HTML_Tag_Processor
.
We should try to avoid this unnecessary processing if possible.
Change History (11)
This ticket was mentioned in PR #6251 on WordPress/wordpress-develop by @joemcgill.
6 months ago
#1
- Keywords has-patch added
This ticket was mentioned in Slack in #core-performance by joemcgill. View the logs.
6 months ago
This ticket was mentioned in Slack in #core-performance by joemcgill. View the logs.
6 months ago
#5
@
6 months ago
- Keywords dev-reviewed added
@swissspidy, it would be nice to have this fix included as well.
#6
@
6 months ago
- Component changed from General to Editor
- Keywords commit dev-feedback added; dev-reviewed removed
- Priority changed from high to normal
#7
@
6 months ago
- Owner set to swissspidy
- Resolution set to fixed
- Status changed from new to closed
In 57824:
#8
@
6 months ago
- Keywords fixed-major dev-reviewed added; dev-feedback removed
- Resolution fixed deleted
- Status changed from closed to reopened
This is a modified PR based on @gziolo's initial approach in this Slack thread.
The main change from his original proposal is to use
str_contains()
instead ofstr_pos()
given that we have a polyfill for this in Core now. This reduces calls towp_interactivity_process_directives()
on the Twenty Twenty-four homepage from 9 to 1 along with memory consumption related to theWP_HTML_Tag_Processor
.Trac ticket: https://core.trac.wordpress.org/ticket/60749