Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:125159 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 47A051ADE00 for ; Fri, 23 Aug 2024 18:20:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1724437328; bh=Zu5bKUEQc4SaSYcikBcu7rL/Cq1KTuZ0ttyHAtW6pfk=; h=Date:From:To:In-Reply-To:References:Subject:From; b=FOhNmNFDYbeixnU5sLiPhyQwFQo8ac+5V8jLBT5ig1JHGz4TuOME9lsh07VSEvnpr N5oB4NbXPZx8NsC/3SRhQjAXF/Q1hgNKf+RUqUxwySFlcCINuEdih8u5KOp8UDfiEc gBCRZ2pGGF/YL4UBTK5gfgqN8QvT6Zo4vyTQ+PzJuI3djolvKxau+w4tqAIMxzlZhI yS8k18ZNkT0gw7ypfHuqkUxhumpYNfOmFwfATIUMTbqZOXN0bIHYB+oVGttH/cV5TT UBs/M2pLguP5RilUn0zTOUM33giq25w50xRqEAEpqsu3cAQVdnWXCULtTlm1AlISm1 V9U7nG2w/x8Zg== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 4C7D118038A for ; Fri, 23 Aug 2024 18:22:05 +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,SPF_HELO_PASS,SPF_PASS autolearn=no autolearn_force=no version=4.0.0 X-Spam-Virus: No X-Envelope-From: Received: from fhigh7-smtp.messagingengine.com (fhigh7-smtp.messagingengine.com [103.168.172.158]) (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 ; Fri, 23 Aug 2024 18:22:03 +0000 (UTC) Received: from phl-compute-03.internal (phl-compute-03.nyi.internal [10.202.2.43]) by mailfhigh.nyi.internal (Postfix) with ESMTP id C3AAF11507EC for ; Fri, 23 Aug 2024 14:20:11 -0400 (EDT) Received: from phl-imap-09 ([10.202.2.99]) by phl-compute-03.internal (MEProxy); Fri, 23 Aug 2024 14:20:11 -0400 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=1724437211; x=1724523611; bh=Zu5bKUEQc4 SaSYcikBcu7rL/Cq1KTuZ0ttyHAtW6pfk=; b=TK0C8VZM2PKaAKSNHhEMPyrWcS NSyPhniP6F8lpFszZVhWcnoskRg28FfkS+Aj+5TEXfl8ZKNO5JshbEgysF9T9Ssz Dp6bqH2qySCJ+Wc716B4iGXLcWbZIQq5q5cnCqsekJc1vlszkdaPANHvOXDpcjzh XGgFnra2qsHYgGdApqr7y/nLqee1muKZWZ5Hd2yTbL8TdCt0amNofs5Ys66LE5/+ 0yEwd/P3yWpZnUArFtiDAMJiqQhm+M6nQcDJjsupSUV8Jat4xnEdUAWdWteL2DXK UhuNjTi+jL9ayURgV94NiaxYWxMDV7pT9wlRVuz2Gjlz+3ac+veuvurSrQ5w== 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-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm1; t=1724437211; x=1724523611; bh=Zu5bKUEQc4SaSYcikBcu7rL/Cq1K TuZ0ttyHAtW6pfk=; b=KZLr+Sriw7gxrNLdWfjqC+hpJ21oZeXPm5scqlN5Luul RvC5ozgI+c3GJjc6slcTp69HeMSh15CfRIgBf8ldOXw23lGjn7192+5JAt1Gj11G 3St3R+FovJXLEX5T3dTwDn9m15ns00G5ZhntIkBW1nQc31jGi2PwuKQC7fwT4jqj MK5wI1/Hc8SJsgqHwh/iaPjmMhxnQVpnNG+hW5CcWg05FIzpKTf0QW3lqiq0xD28 aU5kTbtoAPng5qtCU9IRxDEIr4cumO4OXXk9GNkbaLuUZ8S8mO4eOr5DZslT6HWV 38w+F3JUMKAZ2MWokgKwB1YPHHHOvg0QYXTuNTfioA== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeftddruddvvddguddvvdcutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpggftfghnshhusghstghrihgsvgdp uffrtefokffrpgfnqfghnecuuegrihhlohhuthemuceftddtnecunecujfgurhepofggff fhvffkjghfufgtsegrtderreertdejnecuhfhrohhmpedftfhosgcunfgrnhguvghrshdf uceorhhosgessghothhtlhgvugdrtghouggvsheqnecuggftrfgrthhtvghrnheptdeuje dttefhueelhfdtleeiudetlefftdduleehffegtdeihefhleeijefgveegnecuvehluhhs thgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomheprhhosgessghothhtlh gvugdrtghouggvshdpnhgspghrtghpthhtohepuddpmhhouggvpehsmhhtphhouhhtpdhr tghpthhtohepihhnthgvrhhnrghlsheslhhishhtshdrphhhphdrnhgvth X-ME-Proxy: Feedback-ID: ifab94697:Fastmail Received: by mailuser.nyi.internal (Postfix, from userid 501) id 7FD34780065; Fri, 23 Aug 2024 14:20:11 -0400 (EDT) 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: Fri, 23 Aug 2024 20:19:49 +0200 To: internals@lists.php.net Message-ID: In-Reply-To: References: <21D6F160-5EAE-44FA-907B-E1DAAC1B8D75@rwec.co.uk> <53BD062A-4D7F-4E5D-852E-6D27641213A8@koalephant.com> <7607FD64-5572-466E-9866-63C2536B2A09@koalephant.com> <0d269a38-28fe-494c-a903-50022e09f27b@app.fastmail.com> <63DAE337-B117-4380-8735-186DC30FE0B7@rwec.co.uk> Subject: Re: [PHP-DEV] [Concept] Flip relative function lookup order (global, then local) Content-Type: multipart/alternative; boundary=4892213702ba4cafbd2ec6af4a039e9a From: rob@bottled.codes ("Rob Landers") --4892213702ba4cafbd2ec6af4a039e9a Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On Fri, Aug 23, 2024, at 19:32, Ilija Tovilo wrote: > On Fri, Aug 23, 2024 at 5:49=E2=80=AFPM Rowan Tommins [IMSoP] > wrote: > > > > Other proposals aim to shift that balance - leaving some inconsisten= cy, but less compatibility break. > > > > And most users don't object to using a leading backslash, they just = (quite reasonably) have no idea what impact it has on the ability of the= engine to optimise their code. >=20 > For some context: Before proposing this change, I asked Symfony if > they were interested in disambiguating calls to improve performance, > given I did some work to make fully qualified calls faster. But they > were not, stating that the change would be too verbose for their > liking. I think if someone values code beauty more than speed, they can do that.= Although, I find that rather hilarious when their code base is littered= with goto, =E2=80=9Cfor speed.=E2=80=9D What it really sounds like is that they realized you would just change t= he language and they wouldn=E2=80=99t have to review those changes=E2=80= =A6 /s >=20 > Making unqualified calls to mean local would force Symfony into making > the change, which is not the approach I'm interested in taking. Making > them global would likely reduce breakage by much, but not nearly as > much as keeping the fallback. I don=E2=80=99t think changing the language for a specific framework(s) = is a good idea. >=20 > From reading the responses, it seems we have three primary camps: >=20 > 1. People who don't think BC is a problem, and would like to drop > either the global or local lookup entirely, requiring disambiguation. > 2. People who do think BC is a problem, and would like some opt-in > mechanism to explicitly pick global or local scope. > 3. People who aren't convinced that the performance improvements are > worth it to begin with, or that the developers themselves are > responsible for disambiguation. >=20 > IMO, 1. is too drastic. As people have mentioned, there are tools to > automate disambiguation. But unless we gain some other benefit from > dropping the lookup entirely, why do it? Consistency with class > lookups is a factor, but is it enough to break a large portion of > codebases? The summed up time of every maintainer installing and > running a tool that modifies a large portion of the codebase, and then > dealing with conflicts in existing branches is not miniscule. Fixing > local calls will also require context from other files to correctly > disambiguate. I'm not aware if any tools actually consider context, or > just take the naive approach of making known, internal calls global, > and leaving the rest. Aren=E2=80=99t we doing that anyway with your proposal? Sure, maybe that= doesn=E2=80=99t require (much) changes, right now. But there is an RFC = being discussed right now which introduces a new function called =E2=80=9C= parse_html=E2=80=9D This seems like a super generic name that did not take global-first into= account. I know for a fact I have seen code with that exact function na= me several times in my career. >=20 > 2. misses the point of the immediate performance gains without > modifications to the codebase. Even if the disambiguation itself is a > one-liner, it still needs to be added to every codebase and every > file, and still requires fixing actual local calls that may be made > within the same file. >=20 > I obviously also disagree with 3. as I wouldn't have sent this > proposal otherwise. :) Performance improvements are hard to come by > nowadays. It was measured on real codebases (Symfony and Laravel). >=20 > Ilija >=20 Applications are more likely to get better performance gains in symfony = by uninstalling doctrine and writing optimized queries, to be completely= honest. =E2=80=94 Rob --4892213702ba4cafbd2ec6af4a039e9a Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: quoted-printable

=
On Fri, Aug 23, 2024, at 19:32, Ilija Tovilo wrote:
On Fri, Aug 23, = 2024 at 5:49=E2=80=AFPM Rowan Tommins [IMSoP]
<imsop.php@rwec.co.uk> wrote:
>
> Other proposals aim to shift that balanc= e - leaving some inconsistency, but less compatibility break.
<= div>>
> And most users don't object to using a leadi= ng backslash, they just (quite reasonably) have no idea what impact it h= as on the ability of the engine to optimise their code.
For some context: Before proposing this change, I asked Sym= fony if
they were interested in disambiguating calls to im= prove performance,
given I did some work to make fully qua= lified calls faster. But they
were not, stating that the c= hange would be too verbose for their
liking.

I think if someone values code beauty more = than speed, they can do that. Although, I find that rather hilarious whe= n their code base is littered with goto, =E2=80=9Cfor speed.=E2=80=9D

What it really sounds like is that they realized = you would just change the language and they wouldn=E2=80=99t have to rev= iew those changes=E2=80=A6 /s


Making unqualified calls= to mean local would force Symfony into making
the change,= which is not the approach I'm interested in taking. Making
them global would likely reduce breakage by much, but not nearly as
much as keeping the fallback.
I don=E2=80=99t think changing the language for a specific f= ramework(s) is a good idea.


From reading the responses, i= t seems we have three primary camps:

1. Peo= ple who don't think BC is a problem, and would like to drop
either the global or local lookup entirely, requiring disambiguation.<= br>
2. People who do think BC is a problem, and would like som= e opt-in
mechanism to explicitly pick global or local scop= e.
3. People who aren't convinced that the performance imp= rovements are
worth it to begin with, or that the develope= rs themselves are
responsible for disambiguation.

IMO, 1. is too drastic. As people have mentioned, t= here are tools to
automate disambiguation. But unless we g= ain some other benefit from
dropping the lookup entirely, = why do it? Consistency with class
lookups is a factor, but= is it enough to break a large portion of
codebases? The s= ummed up time of every maintainer installing and
running a= tool that modifies a large portion of the codebase, and then
<= div>dealing with conflicts in existing branches is not miniscule. Fixing=
local calls will also require context from other files to= correctly
disambiguate. I'm not aware if any tools actual= ly consider context, or
just take the naive approach of ma= king known, internal calls global,
and leaving the rest.

Aren=E2=80=99t we doing that an= yway with your proposal? Sure, maybe that doesn=E2=80=99t require (much)= changes, right now. But there is an RFC being discussed right now which= introduces a new function called =E2=80=9Cparse_html=E2=80=9D
=

This seems like a super generic name that did not ta= ke global-first into account. I know for a fact I have seen code with th= at exact function name several times in my career.


2.= misses the point of the immediate performance gains without
modifications to the codebase. Even if the disambiguation itself is a=
one-liner, it still needs to be added to every codebase a= nd every
file, and still requires fixing actual local call= s that may be made
within the same file.
I obviously also disagree with 3. as I wouldn't have sent th= is
proposal otherwise. :) Performance improvements are har= d to come by
nowadays. It was measured on real codebases (= Symfony and Laravel).

Ilija
<= br>

Applications are more likely t= o get better performance gains in symfony by uninstalling doctrine and w= riting optimized queries, to be completely honest.

=E2=80=94 Rob
--4892213702ba4cafbd2ec6af4a039e9a--