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

WordPress Trac noreply at wordpress.org
Mon Nov 14 11:02:09 UTC 2022


#22951: Performance enhancements for esc_url()
-------------------------------------------------+-------------------------
 Reporter:  markjaquith                          |       Owner:  schlessera
     Type:  defect (bug)                         |      Status:  assigned
 Priority:  normal                               |   Milestone:  6.2
Component:  Formatting                           |     Version:  2.8
 Severity:  normal                               |  Resolution:
 Keywords:  has-patch 2nd-opinion dev-feedback   |     Focuses:
  needs-testing                                  |  performance
-------------------------------------------------+-------------------------

Comment (by mukesh27):

 @azaozz thanks for the feedback. I have submitted second approach
 [https://github.com/WordPress/wordpress-develop/pull/3615 PR #3615]. There
 is some unit tests failing due to string case that i'm checking.

 The current version of `esc_url` from trunk and my modified version have
 been compared using benchmarks. To eliminate variations caused by server
 resource allocations as much as feasible, both versions of each benchmark
 are run on the same computer from within the same process, with only the
 relative change being recorded. The benchmark results are displayed in a
 table here:
 https://docs.google.com/spreadsheets/d/1eR80SuQkn1gZc4pfWE1D6enbYSlpRDqharfBtAkTLb0/edit?usp=sharing

 The benchmark summary states that this improvement should speed up the
 `esc_url` function by 15% to 20% under typical use conditions. While the
 worst-case scenario (essentially, handling 100% broken protocol links)
 results in a slowdown of 1.2%, I consider this tolerable considering the
 extremely low likelihood that this will ever happen.

 The test script I've used to run the benchmarks can be found here:
 https://gist.github.com/mukeshpanchal27/2f89f1fe0ed6c6ee091bf17d6e08bbb6
 (I have edited/updated @schlessera code in this script)

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


More information about the wp-trac mailing list