[wp-trac] [WordPress Trac] #58532: Improve performance and simplify usage of `block_has_support()` by supporting a string feature and avoiding `_wp_array_get()` for them

WordPress Trac noreply at wordpress.org
Wed Aug 9 22:34:41 UTC 2023


#58532: Improve performance and simplify usage of `block_has_support()` by
supporting a string feature and avoiding `_wp_array_get()` for them
---------------------------------------------+--------------------------
 Reporter:  flixos90                         |       Owner:  thekt12
     Type:  enhancement                      |      Status:  assigned
 Priority:  normal                           |   Milestone:  6.4
Component:  General                          |     Version:
 Severity:  normal                           |  Resolution:
 Keywords:  has-patch has-unit-tests commit  |     Focuses:  performance
---------------------------------------------+--------------------------
Changes (by flixos90):

 * keywords:  has-patch has-unit-tests changes-requested => has-patch has-
     unit-tests commit


Comment:

 After some quick performance benchmarks, there is no notable performance
 impact from this change, which is in line what I had seen earlier. This
 change is mostly about improving the API: Given most features to check for
 are simple strings, it is more intuitive to check for them like that, e.g.
 that way is in line with other feature check functions in WP core such as
 for post type support.

 In terms of performance, the impact is negligible. It is safe to assume
 that the string check is marginally faster than using `_wp_array_get()`,
 but the change is certainly more about API clarity than about performance.

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


More information about the wp-trac mailing list