[wp-trac] [WordPress Trac] #58206: Replace usage of strpos with str_contains
WordPress Trac
noreply at wordpress.org
Fri May 12 14:15:46 UTC 2023
#58206: Replace usage of strpos with str_contains
-------------------------------------+-------------------------------------
Reporter: spacedmonkey | Owner: SergeyBiryukov
Type: enhancement | Status: assigned
Priority: normal | Milestone: 6.3
Component: General | Version:
Severity: normal | Resolution:
Keywords: good-first-bug has- | Focuses: performance, coding-
patch 2nd-opinion changes- | standards
requested |
-------------------------------------+-------------------------------------
Comment (by spacedmonkey):
I run benchmarks against this change. I see a net posative.
500 runs of the benchmark - trunk (
0746cc7324b4b025d1ad3f2afeeb2aadd7d1d19f ) - Theme tt1.
|| || Trunk - PHP 7.4 || PR - PHP 7.4 || Trunk - PHP 8.0 || PR - PHP 8.0
||
|| Response Time (median) || 79.64 || 79.6 || 79.4 || 79.31 ||
|| wp-before-template (median)||32.88 || 32.93 || 32.39 || 32.24 ||
|| wp-template (median)||40.59 || 40.42 || 40.09 || 40.59 ||
|| wp-total (median)||73.72 || 73.37 || 72.57 || 72.77 ||
There is not a notable improvement performance. As a code quality
improvement, this is +1 from me. There are lots of parts of core that use
str_contains. For consistency we should use it everywhere.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/58206#comment:13>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list