Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:129726 X-Original-To: internals@lists.php.net Delivered-To: internals@lists.php.net Received: from php-smtp4.php.net (php-smtp4.php.net [45.112.84.5]) by lists.php.net (Postfix) with ESMTPS id 8FD8F1A00BC for ; Tue, 30 Dec 2025 21:00:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1767128418; bh=yoD3tLx8Ow+r4aLP7fWkc5txSZgIh8G8DF4QSPxYJzs=; h=From:Subject:Date:References:To:In-Reply-To:From; b=h/ObiM3+qRC1DIAqChYYwmG3tudV09MtoWxZX56FMcDkUTLfuXBMnoIAUc8eyWaE+ wq9b8iiShOQ0EjTGwsmhoaI/KKE0GzG/e49X/YY0KoohSq0Bkk7lm8ixiQ8Vwl0a80 nV7qGnTLsp06asBpsVqzA2xJy1rVXJkOobQ/2dtWB9OXSbOeub0Xpoe5ZxT36hsGZm gqbqpY40MBfbjs1lq09TAK8T/OHuzssdeayhUiB1CYejEELHq3Zbc100Y665w2WNly 3dCJzijHDdz+Jdfc8kGdzPIeurZUs09jGUZLQhZlmRqcUM9EXj0k9IsnjGuUYVO/kO LO1Eg7CSsZEjQ== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 3C1ED180087 for ; Tue, 30 Dec 2025 21:00:17 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=0.6 required=5.0 tests=BAYES_50,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_PASS,FREEMAIL_FROM, HTML_MESSAGE,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL, SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=4.0.1 X-Spam-Virus: No X-Envelope-From: Received: from mail-ej1-f54.google.com (mail-ej1-f54.google.com [209.85.218.54]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Tue, 30 Dec 2025 21:00:16 +0000 (UTC) Received: by mail-ej1-f54.google.com with SMTP id a640c23a62f3a-b7697e8b01aso1879965166b.2 for ; Tue, 30 Dec 2025 13:00:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1767128410; x=1767733210; darn=lists.php.net; h=message-id:in-reply-to:to:references:date:subject:mime-version:from :from:to:cc:subject:date:message-id:reply-to; bh=A1976IPvNAnABWGJC0bcyR1YvqKKgKWo38DaFddfcFE=; b=SR/OELweh21WLT6m3CaIu5JfoNzRGYsfu5Hdqrm8VV3HJu3dUhaWVx1VT3+eouAG+Y nI4/PJzf63asyVoDadx6zmdxF0YMSw+6Omp/V5eR4BbwOwVcTkACcYJPE1LzvfpdzT10 p/Vx+Mkv4BcfMqswInLrAGLYMNZuO1aIuo1VRvhQ0kPOrpKEniZWcKq4vVOFEzNf9Q1D +4CaakefGNm68dCtXSZVZ+GbsmaaTNPt4cAkR6t8UvXKSsLeCVGqQA5Rh+pnpTnZ1bPt 1I8TPTKXGpMxCE8mM6YUpqQ6atVAgYRnYLtq+KK+giw4SelsOvj3yC7n2OemJJ2eqJIp MXdw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1767128410; x=1767733210; h=message-id:in-reply-to:to:references:date:subject:mime-version:from :x-gm-gg:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=A1976IPvNAnABWGJC0bcyR1YvqKKgKWo38DaFddfcFE=; b=J5Z6ml4zPT1v5+eJcnVIORUTNxDqk4aSI7XJ6bT39cydt6uaCtWMGrrQvn0d+yQnej J4iRc7Fh+wnfhXwvT8jVHvYiOjX1gE40tXOZkriWaXLDSnavcr0iFvfH2MjhzQbyHBKG 5R1GSKoO588ux4s43qMjYt8tCM+EwnaPRDf+7tnAjHuK7rPJ/OiIH6c6Mt7UnUTndVub WxqA5l1cXnTqg3Amy8G1Hd84/A4qHBgVlXzfFiA14QqWxGfvu7A4x0gSYHaHEKN8Na5x pTxGGQPRwhJs3RTnRkFT6OfbB8G7o65JkzsftREReV+AjiXOsWhxQKHrw+4CojJc6Z31 uk1w== X-Gm-Message-State: AOJu0YwVQqleTbfKJzPXikZDjhSrmIpAaeUDidtH0G49RnnGnh+TM24T 8doWtNSKqA7Q6vidFzkk7PR/L7ofJbtXxFBKCQ5igsDXc3PR3YR3NetBUYy+UA== X-Gm-Gg: AY/fxX4uJjrI3MsR3iRoJ1Aexsxj+F1LOXDikApuh+fk3IbgnHppGK2CW9HJ6D9DOpS AXJxkIyIplTA9v0yITf7ZUCP5mpXFUku2C2BuA+crKrM1AqeJJxDTFTCbf04NOdIlHPdfWn5Yxf RQ9kR2diMSAsfyjwF7SFMHtDmzD+nxJfeynsFw8Gva6yIYIMoqCLCI7+h+3b1JBSdYuQwwjmF3C N9JPSbbLnNB5vq0c+mXWSMn+eQeSmWx5kFxlojg1OAx+EMjiHvPzqnN7IjdLh2udi6vQS8TCwCq geruN8Z6W8+F19gNT1hgfGQEP04AlbnKyqAhUIVCf+2TbDIItlAVR3sbucTgAr/NKASQYFFQgV3 nSZldah8ddFBrrWSV00xTsa+EAX3qzXbI4bNs15gxmjARsFGeslpjmWvTwThodPTjz6cngnvwwK M8C43uSDfMlcslI8RA5StnyjZnWZGBscuu0w== X-Google-Smtp-Source: AGHT+IHQNzzw9oodJLxkdrfCXZl86cPXvjbkdcf6MGwWCkh67T+arsc7wpbr7X/6POFoy5xiKo0w/Q== X-Received: by 2002:a17:906:2082:b0:b80:3fb3:bdf6 with SMTP id a640c23a62f3a-b803fb3bf41mr2319836166b.40.1767128409790; Tue, 30 Dec 2025 13:00:09 -0800 (PST) Received: from smtpclient.apple ([2a02:2f0c:c107:3700:55c5:eeff:b4e9:2e7a]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-b838c69f87csm539640766b.27.2025.12.30.13.00.08 for (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 30 Dec 2025 13:00:09 -0800 (PST) Content-Type: multipart/alternative; boundary="Apple-Mail=_849A4C57-0585-41C8-8D70-9DE01ED485A8" Precedence: list list-help: list-unsubscribe: list-post: List-Id: x-ms-reactions: disallow Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3826.700.81\)) Subject: Re: [PHP-DEV] [Discussion] Reflection-based constructor autowiring (scope clarification) Date: Tue, 30 Dec 2025 22:59:58 +0200 References: <6C2A8D96-BB4C-4091-85D8-21654C242364@gmail.com> To: "internals@lists.php.net" In-Reply-To: Message-ID: X-Mailer: Apple Mail (2.3826.700.81) From: azolee@gmail.com (=?utf-8?B?QU5EUsOBUyBab2x0w6FuIEd5w6FyZsOhcw==?=) --Apple-Mail=_849A4C57-0585-41C8-8D70-9DE01ED485A8 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 Hi Marco, Thank you, that=E2=80=99s very clear and actionable. I=E2=80=99ll 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=E2=80=99ll follow up once I have data to share. Best regards, Zoli eng. ANDR=C3=81S Zolt=C3=A1n-Gy=C3=A1rf=C3=A1s --------------------------------------- tel: +40 745 797 798 mail: azolee@gmail.com > On 30 Dec 2025, at 20:41, Marco Pivetta wrote: >=20 > Hey Zoli, >=20 > On Tue, 30 Dec 2025 at 08:17, ANDR=C3=81S Zolt=C3=A1n Gy=C3=A1rf=C3=A1s = > wrote: >> If you have any guidance on what you would consider a representative = benchmark or a meaningful performance threshold for =E2=80=9Cworth = moving into core=E2=80=9D, I=E2=80=99d appreciate it. >>=20 >=20 > 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.). >=20 > You may design a PHPBench or Hyperfine test that: >=20 > * 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. >=20 > You probably care about these cases: >=20 > * zero-arguments constructor > * simple concrete class references > * default constructor arguments > * resolvers > * autowiring of a complex multi-level structure >=20 > 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. >=20 > Marco Pivetta=20 >=20 > https://mastodon.social/@ocramius >=20 > https://ocramius.github.io/ > =20 --Apple-Mail=_849A4C57-0585-41C8-8D70-9DE01ED485A8 Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=utf-8

Hi Marco,

Thank = you, that=E2=80=99s very clear and actionable.

I=E2=80=99ll 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=E2=80=99ll follow up once I have = data to share.

Best = regards,

Zoli



eng. ANDR=C3=81S = Zolt=C3=A1n-Gy=C3=A1rf=C3=A1s
---------------------------------------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=C3=81S Zolt=C3=A1n Gy=C3=A1rf=C3=A1s <azolee@gmail.com> = wrote:

If you have any guidance on = what you would consider a representative benchmark or a meaningful = performance threshold for =E2=80=9Cworth moving into core=E2=80=9D, = I=E2=80=99d 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.


= --Apple-Mail=_849A4C57-0585-41C8-8D70-9DE01ED485A8--