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. 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. I dunno if any of this helps you to decide if it's good or bad, but I'm particularly interested in your concrete answer to the question of badness. Cheers Joe On Wed, 26 May 2021 at 12:30, Marco Pivetta <ocram...@gmail.com> wrote: > > > On Wed, May 26, 2021 at 12:14 PM Joe Watkins <krak...@php.net> wrote: > >> Hi internals, >> >> In response to: https://bugs.php.net/bug.php?id=78480 >> >> I implemented: https://github.com/php/php-src/pull/7029 >> >> Not absolutely convinced that it's a good idea, I asked Nikita to review, >> and he's unconvinced also and suggested a discussion should be started. >> >> You can read both of our thoughts about it on the PR. >> >> What I'm looking for now, is reasons that we are wrong - good use cases >> that aren't born from code that is doing bad things ... >> >> Equally if you think this is really bad even if the reason has already >> been >> mentioned, please make noise. >> > > > What's the problem with good 'ol `(new ReflectionProperty(Foo::class, > 'bar'))->isInitialized($baz)` ? > > If it's instantiation time/performance, I'm fairly sure that typical > reflection instantiation caching works just fine (and a new API would need > a lot of meaningful benchmarks to be warranted). > > Marco Pivetta > > http://twitter.com/Ocramius > > http://ocramius.github.com/ > >