createProxy( Foo::class, static function ( ?object & $wrappedObject, ?object $proxy, string $method, array $parameters, ?Closure & $initializer ) { $initializer = null; $wrappedObject = new Foo(); return true; } ); $i += 1; } while ($i < 1000); var_dump('time after 1000 instantiations: ' . (microtime(true) - $startTime)); $proxy->doFoo(); var_dump('time after single call to doFoo: ' . (microtime(true) - $startTime)); })();