Hey Joe, <http://ocramius.github.com/>
On Wed, May 26, 2021 at 12:56 PM Joe Watkins <krak...@gmail.com> wrote: > Hi Marco, > > What do you mean by "meaningful benchmarks" ? > > There's no question that is_initialized will be faster than the reflector > version, even with reflection caching. > Ack, but real-world impact seems irrelevant? I've worked on stuff that heavily relies on checking initialized state, and most of it is mostly unaffected. "meaningful benchmark" means "here's a use-case that really needs `is_initialized()`, and absolutely cannot run into the penalties of `ReflectionProperty#isInitialized()` > Here's a naive bench: > https://gist.github.com/krakjoe/cef6452281624bdf1b46788f52a01521 > > krakjoe@Fiji:/opt/src/php-src$ sapi/cli/php initialized.php > is_initialized: 0.04558 seconds > reflection: 0.07186 seconds > > However is_initialized has a narrower scope than the reflector version, as > mentioned in the PR, it specifically can only work on typed (accessible > from calling scope) properties. > Sounds weird? Why would a narrower version be needed at all? Marco Pivetta http://twitter.com/Ocramius http://ocramius.github.com/ >