[wp-trac] [WordPress Trac] #22951: Performance enhancements for esc_url()

WordPress Trac noreply at wordpress.org
Wed Jan 11 15:21:33 UTC 2023


#22951: Performance enhancements for esc_url()
------------------------------+--------------------------
 Reporter:  markjaquith       |       Owner:  flixos90
     Type:  defect (bug)      |      Status:  closed
 Priority:  normal            |   Milestone:  6.2
Component:  Formatting        |     Version:  2.8
 Severity:  normal            |  Resolution:  fixed
 Keywords:  has-patch commit  |     Focuses:  performance
------------------------------+--------------------------
Changes (by flixos90):

 * status:  assigned => closed
 * resolution:   => fixed


Comment:

 In [changeset:"55053" 55053]:
 {{{
 #!CommitTicketReference repository="" revision="55053"
 Formatting: Improve performance of `esc_url()`.

 This changeset indirectly improves performance of the commonly used
 `esc_url()` function by optimizing the low-level function
 `wp_kses_bad_protocol()` for the by far most common scenarios, which are
 URLs using either the `http` or `https` protocol.

 For this common scenario, the changeset now avoids the `do while` loop.
 While for a single call to the `esc_url()` function the performance wins
 are negligible, given that `esc_url()` is often called many times in one
 page load, they can add up, making this a worthwhile improvement.

 Props mukesh27, schlessera, markjaquith, azaozz, spacedmonkey.
 Fixes #22951.
 }}}

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


More information about the wp-trac mailing list