[wp-trac] [WordPress Trac] #59443: Block Supports: Re-use instance of Tag Processor when adding layout classes

WordPress Trac noreply at wordpress.org
Wed Oct 4 10:41:19 UTC 2023


#59443: Block Supports: Re-use instance of Tag Processor when adding layout classes
---------------------------------------+----------------------------
 Reporter:  dmsnell                    |       Owner:  isabel_brison
     Type:  enhancement                |      Status:  reopened
 Priority:  normal                     |   Milestone:  6.4
Component:  Editor                     |     Version:  trunk
 Severity:  normal                     |  Resolution:
 Keywords:  gutenberg-merge has-patch  |     Focuses:  performance
---------------------------------------+----------------------------

Comment (by spacedmonkey):

 Some early finds for my research.

 Of the 20ms that wp_render_layout_support_flag takes on a TT4 page.

 - wp_get_layout_style - 5.25 ms
 - wp_get_global_settings - 4.06ms
 - sanative_title - 3.06ms
 - WP_HTML_Tag_Processor::get_updated_htm - 2.46ms.

 It seems this change creates lots of `WP_HTML_Tag_Processor` instance,
 where before ( in WP 6.3 ) those instances were only created if needed.
 WP_HTML_Tag_Processor is done on innner content in a while loop. A while
 loop is also used to next tag.

 More logic is run if `disable-layout-styles` theme supports in place. So
 different themes will see different results. Which explains some of the
 different noted in findings above.

 Running so many html modifications on every block, feels like it would not
 be good for performance. Some of these blocks could contain lots of html /
 text, making the html parsing process slow.

 I don't have a context to what these changes did. I wonder if we could add
 some conditional logic to make sure that expressive function / class
 classes are avoid, I think that would be helpful for performance.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/59443#comment:23>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list