Hi everyone,
I hope you're all having a great week.
I’ve been following the discussions and recent feedback regarding the
array_str_contains() RFC closely. Performance and speed comparisons have
come up as a key point, especially around whether a dedicated internal C
implementation provides sufficient value compared to a userland foreach
loop.
I'd love to open up a constructive and transparent discussion around the
benchmarking methodology we're using here. Some of the initial numbers
shared recently don't seem to reflect real-world scenarios or different
data profiles (like varying array sizes, early exits vs worst-case lookups,
UTF-8 strings, and compiler optimization flags like -O2 / -O3).
Before drawing final conclusions on performance, I think it would be great
if we could align on:
- The exact benchmark scripts and test datasets we should use to evaluate
this fairly. - The compilation environment and flags used for generating these metrics.
- Where the potential overhead in the current C implementation is coming
from and how we can optimize it together.
My goal has always been to make PHP more expressive and efficient for
everyday developers. I welcome any suggestions, insights, or benchmark
reproductions from the community so we can evaluate this RFC based on
solid, agreed-upon data.
Thanks for your time and feedback!
Best regards,
Sepehr
2026年9月10日(木) 10:07 سپهر محمودی sepehrphpr@gmail.com:
Hi everyone,
I hope you're all having a great week.
I’ve been following the discussions and recent feedback regarding the array_str_contains() RFC closely. Performance and speed comparisons have come up as a key point, especially around whether a dedicated internal C implementation provides sufficient value compared to a userland foreach loop.
I'd love to open up a constructive and transparent discussion around the benchmarking methodology we're using here. Some of the initial numbers shared recently don't seem to reflect real-world scenarios or different data profiles (like varying array sizes, early exits vs worst-case lookups, UTF-8 strings, and compiler optimization flags like -O2 / -O3).
Before drawing final conclusions on performance, I think it would be great if we could align on:
- The exact benchmark scripts and test datasets we should use to evaluate this fairly.
- The compilation environment and flags used for generating these metrics.
- Where the potential overhead in the current C implementation is coming from and how we can optimize it together.
My goal has always been to make PHP more expressive and efficient for everyday developers. I welcome any suggestions, insights, or benchmark reproductions from the community so we can evaluate this RFC based on solid, agreed-upon data.
Thanks for your time and feedback!
Best regards,
Sepehr
Hi Internals
For your reference, I have attached the benchmark diff files. (commit
hash is 4982bf45f4786faaa198558dd619f8a4d59e25f0)
- .diff
- .exp
- .log
- .out
- .php
- .phpt
- .sh
I can not find definite improve performance.
(My PC: WSL Ubuntu 24.04, Ryzen 7 7735HS, 32GB RAM)
I don't familiar with Zend Engine's performance, However I think
function's performance improvement is limited.
Regards
Yuya
--
Yuya Hamada (tekimen)