Files
WordPress/wp-includes
dmsnell ea9e2e1112 Performance: avoid over-allocation in wp_is_numeric_array()
When a trace of allocations revealed that `wp_is_numeric_array()`
accounted for a significant fraction of the allocations in a page
render, it was observed that the function eagerly allocates and copies
array keys and then filters them when all it wants to know is whether a
single key in the array meets a condition.

In this patch the `array_filter( array_keys() )` invocation is replaced
with early-aborting iteration to avoid the memory allocation and
copying.

This patch was prepared as part of WCEU 2026 Contributor Day.

Developed in: https://github.com/WordPress/wordpress-develop/pull/12100
Discussed in: https://core.trac.wordpress.org/ticket/65467

Follow-up to [34927].

Props dmsnell, westonruter, yusufmudagal.
Fixes #65467.

Built from https://develop.svn.wordpress.org/trunk@62524


git-svn-id: http://core.svn.wordpress.org/trunk@61805 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2026-06-18 17:50:43 +00:00
..
2026-05-08 14:04:45 +00:00
2026-05-08 14:04:45 +00:00