Re: [Discussion] Reflection-based constructor autowiring (scope clarification)

From: Date: Tue, 30 Dec 2025 20:59:58 +0000
Subject: Re: [Discussion] Reflection-based constructor autowiring (scope clarification)
References: 1 2 3 4  Groups: php.internals 
Request: Send a blank email to internals+get-129726@lists.php.net to get a copy of this message
Hi Marco, Thank you, that’s very clear and actionable. I’ll focus the benchmarks on cold-start and warm-process scenarios as you outlined, and compare autowiring overhead directly against manual instantiation across the relevant cases. I’ll follow up once I have data to share. Best regards, Zoli eng. ANDRÁS Zoltán-Gyárfás --------------------------------------- tel: +40 745 797 798 mail: azolee@gmail.com > On 30 Dec 2025, at 20:41, Marco Pivetta <ocramius@gmail.com> wrote: > > Hey Zoli, > > On Tue, 30 Dec 2025 at 08:17, ANDRÁS Zoltán Gyárfás <azolee@gmail.com > <mailto:azolee@gmail.com>> wrote: >> If you have any guidance on what you would consider a representative benchmark or a >> meaningful performance threshold for “worth moving into core”, I’d appreciate it. >> > > In the grand majority of cases where autowiring is meaningful (at least for PHP), you care > about a "cold start" of the application (although that's changing with > ReactPHP/FrankenPHP/Roadrunner/etc.). > > You may design a PHPBench or Hyperfine test that: > > * starts a PHP process, autowires something, shuts down. Hyperfine helps a lot here. > * repeats the above, but within a warm process (classes already loaded, tight loop repeating > the operation). PHPBench is a bit more precise here. > > You probably care about these cases: > > * zero-arguments constructor > * simple concrete class references > * default constructor arguments > * resolvers > * autowiring of a complex multi-level structure > > In all the above cases, you probably care about the usage with autowiring API vs the usage via > direct instantiation, so you can see the exact overhead. > > Marco Pivetta > > https://mastodon.social/@ocramius > > https://ocramius.github.io/ >

« previous php.internals (#129726) next »