Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:126026 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 qa.php.net (Postfix) with ESMTPS id 397091A00BD for ; Thu, 21 Nov 2024 14:17:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1732198804; bh=OGlrvIDDhoQXNv78AlgQEAsUEvYstvO+BJMiU2PyLJk=; h=Date:From:To:In-Reply-To:References:Subject:From; b=alPxi4vUqAvqnWMgaJsy7UXKIa0yQqhFLYlq5PDWKzhX3j12I8MgGTjQ5rGL2bM6O N3NugAb35Jb8xLLyy/pq9BzJVTG+e4zEmc0dR0MZvar/MRlxNwmzcSGZe/A7pGLE62 5vfoC74LktQALS2dXBtBLWgSmAo5Lw2fDWo/6Eviporv+8dn1pP6GtyYW3tVX+C5ZF zW6xcZfmUrCrUG4/QK9zRO6KBhSn0oGcwcIJDv7EF8/6wzaG9HY4kxbICKU20FQUrw Cr8O71m3yzZsEcUbIFef7DLVZg8U38kA2Ec7OppjW6Lyv8P3tL0qOYC/VavcvAEcg5 vP6Dz4aAFl4OQ== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 1679B180088 for ; Thu, 21 Nov 2024 14:20:04 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 4.0.0 (2022-12-13) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=-0.1 required=5.0 tests=BAYES_50,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_MISSING,HTML_MESSAGE, RCVD_IN_DNSWL_LOW,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS autolearn=no autolearn_force=no version=4.0.0 X-Spam-Virus: No X-Envelope-From: Received: from fhigh-a1-smtp.messagingengine.com (fhigh-a1-smtp.messagingengine.com [103.168.172.152]) (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 ; Thu, 21 Nov 2024 14:20:03 +0000 (UTC) Received: from phl-compute-01.internal (phl-compute-01.phl.internal [10.202.2.41]) by mailfhigh.phl.internal (Postfix) with ESMTP id 0C8791140206 for ; Thu, 21 Nov 2024 09:17:23 -0500 (EST) Received: from phl-imap-09 ([10.202.2.99]) by phl-compute-01.internal (MEProxy); Thu, 21 Nov 2024 09:17:23 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bottled.codes; h=cc:content-type:content-type:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:subject :subject:to:to; s=fm2; t=1732198643; x=1732285043; bh=OGlrvIDDho QXNv78AlgQEAsUEvYstvO+BJMiU2PyLJk=; b=FUTWmu3Mnn8F+IvNGqtJXFe893 0/Gbe4M8XDfxmOy4ZT7knCFAkJ1d/ZJ4jDN+r28kudNBKkzOrunccn1SvWZEs40y oXuKUxzYQZGH+/YpcFmBS7eC8FGhZBWJEVnWh5dMpO9sCszxjf27mQhnORh51MkS jUFV7xZEY7fTbloORj1bT+7BuJBSRwCv+CVK4uWht/BBzY4/gjZZoSQhu47rD018 OVeYyRcfEHUw6EYbhKa/a4UNuqPx1jRbpiUqV1LvPCo78rg7z/ABlgnJVB32aIC4 sO0FGc8K9kPfHBxt51e5T1A/OxzdKl1exa+cnkMzHwkcw0pCV6L0HJPzGH5g== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:subject:subject:to :to:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t= 1732198643; x=1732285043; bh=OGlrvIDDhoQXNv78AlgQEAsUEvYstvO+BJM iU2PyLJk=; b=dBhrEG9GSWwotkO0c7mC6XFFsT9KIHX3voQLm1g3M5o4OfYAE28 2cymaFy5KAjQtyqiZO+BwLan3+LfwYjCjiPhUMJN3g0HLTqK6V9WzGMnNauWApyk BK3uKV6DwNxlSH/HEypdjK7aM7aG/0MhOvz3fG7JjSKFOzzMWXz/mHRaB6bPBpnY 06iOOGgLfqunH30VvXYnIE2Haf4jFrfLNYr7euW1Qec130ZRGOi1NYqUZ/F/HqeT qwN4N+JLh8+JHiXxxLgL+LGkozzQg12C8lQfWKzuhWHRY0NajoZOLEgk/5d+6hlI kpPiN6xyKer//jcXy26vggCWeJxZ9dHx3Pw== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefuddrfeeigdeiudcutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpggftfghnshhusghstghrihgsvgdpuffr tefokffrpgfnqfghnecuuegrihhlohhuthemuceftddtnecunecujfgurhepofggfffhvf fkjghfufgtsegrtderreertdejnecuhfhrohhmpedftfhosgcunfgrnhguvghrshdfuceo rhhosgessghothhtlhgvugdrtghouggvsheqnecuggftrfgrthhtvghrnheptdeujedtte fhueelhfdtleeiudetlefftdduleehffegtdeihefhleeijefgveegnecuvehluhhsthgv rhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomheprhhosgessghothhtlhgvug drtghouggvshdpnhgspghrtghpthhtohepuddpmhhouggvpehsmhhtphhouhhtpdhrtghp thhtohepihhnthgvrhhnrghlsheslhhishhtshdrphhhphdrnhgvth X-ME-Proxy: Feedback-ID: ifab94697:Fastmail Received: by mailuser.phl.internal (Postfix, from userid 501) id A9EA4780068; Thu, 21 Nov 2024 09:17:22 -0500 (EST) X-Mailer: MessagingEngine.com Webmail Interface Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net x-ms-reactions: disallow MIME-Version: 1.0 Date: Thu, 21 Nov 2024 15:17:01 +0100 To: internals@lists.php.net Message-ID: <4becf27f-2de1-4c74-9cf0-7dbff7bebf6c@app.fastmail.com> In-Reply-To: <71304D27-1884-4D7B-B3B5-5E5DB753F216@rwec.co.uk> References: <09E90996-133F-47FD-878F-5D1F7A99A3ED@rwec.co.uk> <71304D27-1884-4D7B-B3B5-5E5DB753F216@rwec.co.uk> Subject: Re: [PHP-DEV] opcache_compile_file() declares top-level functions Content-Type: multipart/alternative; boundary=fb6c3c90192947a1a13452ea3a906e70 From: rob@bottled.codes ("Rob Landers") --fb6c3c90192947a1a13452ea3a906e70 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On Thu, Nov 21, 2024, at 13:46, Rowan Tommins [IMSoP] wrote: >=20 >=20 > On 21 November 2024 10:48:46 GMT, Daniil Gentili wrote: > >I speak for myself (and some others, as can be seen by pull requests = on some FOSS projects, which made pull requests to account for this beha= viour), as a user of preloading who has encountered this behaviour, unde= rstood the reason for it and made the required changes to keep using it. >=20 > This is still painfully vague. What projects? What "reason for it" did= you understand? When you say projects accounted for it, do you mean the= y got some benefit from it, or that they worked around the problems it c= aused them? >=20 >=20 > >There is indeed nothing wrong with the listed behaviours IMO, as they= make sense for how the current logic is working, and aren=E2=80=99t a d= eal breaker for preloading. >=20 > This seems to be entirely circular - "the current behaviour makes sens= e for the current behaviour". >=20 >=20 > >In fact preloading in a way behaves as if you included the preload fi= le before including the entry point >=20 > Note that we are not talking about preloading, as a general concept; w= e are talking about the specific function opcache_compile_file. That fun= ction's explicit purpose is to prime the opcache *without* behaving the = same way as including the file.=20 >=20 >=20 > > functions cannot be declared twice, and already-declared classes are= not autoloaded again >=20 > Finally, we seem to get to the use case you are actually advocating: p= recompiling classes but using an autoloader to actually declare them; bu= t fully pre-declaring functions, because there's no autoloader for them. >=20 > That certainly makes sense as a distinction, but I then wonder why you= would use opcache_compile_file for declaring those functions, rather th= an a normal include. Since you can't include the file a second time eith= er way, is there any way to make use of the difference? >=20 >=20 > > it might be a nice idea to simply ignore the redeclaration of functi= ons (like for classes), instead of not preloading them at all. >=20 >=20 > There is nothing that ignores the redeclaration of classes; they are n= ot declared when pre-compiling, and can be declared exactly once by pass= ing include/require the pre-compiled file. Making functions match that b= ehaviour is what Ilija is proposing. >=20 >=20 > Rowan Tommins > [IMSoP] >=20 Seems like function autoloading would alleviate this use case and make t= his behavior easier to deprecate. =E2=80=94 Rob --fb6c3c90192947a1a13452ea3a906e70 Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: quoted-printable
On Thu, Nov 21,= 2024, at 13:46, Rowan Tommins [IMSoP] wrote:


On 21 Nov= ember 2024 10:48:46 GMT, Daniil Gentili <daniil.gentili@gmail.com> wrote:
&g= t;I speak for myself (and some others, as can be seen by pull requests o= n some FOSS projects, which made pull requests to account for this behav= iour), as a user of preloading who has encountered this behaviour, under= stood the reason for it and made the required changes to keep using it.<= br>

This is still painfully vague. What project= s? What "reason for it" did you understand? When you say projects accoun= ted for it, do you mean they got some benefit from it, or that they work= ed around the problems it caused them?


=
>There is indeed nothing wrong with the listed behaviours = IMO, as they make sense for how the current logic is working, and aren=E2= =80=99t a deal breaker for preloading.

This= seems to be entirely circular - "the current behaviour makes sense for = the current behaviour".


>= In fact preloading in a way behaves as if you included the preload file = before including the entry point

Note that = we are not talking about preloading, as a general concept; we are talkin= g about the specific function opcache_compile_file. That function's expl= icit purpose is to prime the opcache *without* behaving the same way as = including the file. 


&g= t; functions cannot be declared twice, and already-declared classes are = not autoloaded again

Finally, we seem to ge= t to the use case you are actually advocating: precompiling classes but = using an autoloader to actually declare them; but fully pre-declaring fu= nctions, because there's no autoloader for them.

That certainly makes sense as a distinction, but I then wonder why= you would use opcache_compile_file for declaring those functions, rathe= r than a normal include. Since you can't include the file a second time = either way, is there any way to make use of the difference?


> it might be a nice idea to simply i= gnore the redeclaration of functions (like for classes), instead of not = preloading them at all.


Ther= e is nothing that ignores the redeclaration of classes; they are not dec= lared when pre-compiling, and can be declared exactly once by passing in= clude/require the pre-compiled file. Making functions match that behavio= ur is what Ilija is proposing.


Rowan Tommins
[IMSoP]


Seems like function autoloading would alleviate = this use case and make this behavior easier to deprecate.

=
=E2=80=94 Rob
--fb6c3c90192947a1a13452ea3a906e70--