Am 23.08.2026 um 17:50 schrieb سپهر محمودی <[email protected]>: > However, my main motivation for this RFC is performance. When dealing with > large arrays, the overhead of executing a callback (even a built-in one) for > every single element in `array_filter` can be quite significant. A dedicated > function implemented purely in C would bypass that overhead and execute much > faster.
Maybe you want to back this up with some benchmarks of real world cases you had to deal with. Personally, we are dealing with large files and in our experience the bottle neck is more often memory than speed. This means we often use a streaming approach for large data sets to avoid having the whole data in memory. Which wouldn't work well with your proposed function and the performance impact would probably negligible. > Do you think the performance gain for such a common use-case justifies having > a dedicated function, or do you feel the language should strictly prefer the > `array_filter` approach despite the overhead? I think the performance of array_filter is good enough for 99% of the cases, preg_grep (which in most cases will be simple enough if the search string is a fixed string) is good enough for 99% of the remaining performance critical cases which dissuades me from adding another function for the remaining 0.01%. Regards, - Chris
