[wp-trac] [WordPress Trac] #58069: Performance of _wp_normalize_relative_css_links() can be increased >2x
WordPress Trac
noreply at wordpress.org
Tue May 9 12:15:59 UTC 2023
#58069: Performance of _wp_normalize_relative_css_links() can be increased >2x
-------------------------------------------------+-------------------------
Reporter: westonruter | Owner:
| westonruter
Type: defect (bug) | Status: closed
Priority: normal | Milestone: 6.2.1
Component: Script Loader | Version: 5.9
Severity: normal | Resolution: fixed
Keywords: has-unit-tests fixed-major has- | Focuses: css,
patch | performance
-------------------------------------------------+-------------------------
Changes (by audrasjb):
* status: reopened => closed
* resolution: => fixed
Comment:
In [changeset:"55736" 55736]:
{{{
#!CommitTicketReference repository="" revision="55736"
Script Loader: Optimize performance of
`_wp_normalize_relative_css_links()` by more than 2x.
- Replace `preg_match_all()` and its secondary `str_replace()` call with
`preg_replace_callback()`.
- Fix case where paths beginning with `http` and `https` (but not `http:`
and `https:`) were erroneously not counted as relative.
- Improve code style and readability by consolidating conditions and
returning once.
- Use `str_starts_with()` consistently instead of `strpos()`.
Follow-up to [52036], [52695], and [52754].
Props westonruter, adamsilverstein, azaozz.
Merges [55658] and [55669] to the 6.2 branch.
Fixes #58069.
See #54243.
}}}
--
Ticket URL: <https://core.trac.wordpress.org/ticket/58069#comment:15>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list