[wp-trac] [WordPress Trac] #62124: wp_parse_url() - code update for performance and removal of now unnecessary code fix
WordPress Trac
noreply at wordpress.org
Thu Sep 26 15:50:39 UTC 2024
#62124: wp_parse_url() - code update for performance and removal of now unnecessary
code fix
--------------------------+--------------------------------------
Reporter: wpseeddoctor | Owner: (none)
Type: enhancement | Status: new
Priority: normal | Milestone: Awaiting Review
Component: HTTP API | Version: trunk
Severity: trivial | Keywords: has-patch has-unit-tests
Focuses: performance |
--------------------------+--------------------------------------
The current code of wp_parse_url() is fixing an issue of the native PHP
function parse_url() in the PHP version around 5.2~5.4+. With the oldest
currently supported PHP version this fix is not necessary. I propose a
very simple code solution that does the same job but 25% faster on average
in a real-world scenario. It passes all unit tests and in half of the
time.
Functions `_get_component_from_parsed_url_array()` and
`_wp_translate_php_url_constant_to_key()` probably can be removed but they
are inside unit tests and I'm not experienced enough to know how to
deprecate them. In WP core codebase there are no references to any of
them.
I made a commit on GitHub with my solution https://github.com/WordPress
/wordpress-develop/commit/325e3b6d01fc3182205b2fbb0794b06c56db533c
--
Ticket URL: <https://core.trac.wordpress.org/ticket/62124>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list