Asymmetric Property Write Performance

php.internals

Holly Schilling

50 days ago
While digging into the code recently, I found a performance penalty for asymmetric property setters that are not public. In testing, I found that `protected` and `private` setters were roughly 4x slower than their `public` counterparts. Code speaks louder than words, so I drafted a PR that removes the performance penalty. The Summary talks about the implementation details more in depth and how to verify the performance. The change is +226/-65 LOC, so fairly small. It might be worth trying to put this fix into 8.6 yet. https://github.com/php/php-src/pull/22709 Holly

Holly Schilling

49 days ago
This didn’t get much attention on the list, but Ilija was kind enough to review my Draft PR. I think this is a good candidate to get into 8.6 yet. I posted a formal RFC for it. I’ll give it a few days for anyone who wants to weigh in on if this should land in 8.6 or wait until the next release. RFC: https://wiki.php.net/rfc/direction_aware_property_resolution PR: https://github.com/php/php-src/pull/22709 Holly

Ilia Alshanetsky

48 days ago
Looks like a great change, definitely a strong candidate for PHP 8.6 inclusion. On Sun, Jul 12, 2026 at 7:32 PM Holly Schilling < holly.a.schilling@outlook.com> wrote:
> While digging into the code recently, I found a performance penalty for > asymmetric property setters that are not public. In testing, I found that > `protected` and `private` setters were roughly 4x slower than their > `public` counterparts. > > Code speaks louder than words, so I drafted a PR that removes the > performance penalty. The Summary talks about the implementation details > more in depth and how to verify the performance. The change is +226/-65 > LOC, so fairly small. It might be worth trying to put this fix into 8.6 yet. > > https://github.com/php/php-src/pull/22709 > > Holly >
-- Ilia Alshanetsky Technologist, CTO, Entrepreneur E: ilia@ilia.ws T: @iliaa B: http://ilia.ws