Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:125154 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 EBA581A00BD for ; Fri, 23 Aug 2024 17:32:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1724434485; bh=HdXncKcULnBroBjszrjgwKisRXRJzTi9KZ/zC1AE1ns=; h=References:In-Reply-To:From:Date:Subject:To:From; b=ZlBl5CDKf3Ki5AyW4MQUktocw8GUiz34QElXdPTasFowP6S7DvqkLwbt+mzfVXiJ0 QkLuOeMV43n1tL/ppoyF+g2mG99wt1g3S+xOFVxUrby1qPMXeTO9RaYf22kTPpg/ZK oexr+qWtnar9ahiTZUX16tHyi6K+hTultmTmltiQeHM+pgFLTOgw+GYD2gRG8ESMfx /df/1HVXTkqL7GhUfl4phgxrHU7w+xrW93afVrRM4/FrOvz4x00yRLzo4TAX5Vy6CW y/tXHvqMj48R2NTYKlP/P/UlUqCOGD0BJEy8hkBJ817xohM/DVQO3M8bBChO4BploM 8qKDHST8bYBug== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 1F149180034 for ; Fri, 23 Aug 2024 17:34:45 +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.6 required=5.0 tests=BAYES_50,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_PASS,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=4.0.0 X-Spam-Virus: No X-Envelope-From: Received: from mail-qv1-f47.google.com (mail-qv1-f47.google.com [209.85.219.47]) (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 17:34:44 +0000 (UTC) Received: by mail-qv1-f47.google.com with SMTP id 6a1803df08f44-6bf9ac165d3so12358336d6.0 for ; Fri, 23 Aug 2024 10:32:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1724434373; x=1725039173; darn=lists.php.net; h=content-transfer-encoding:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=HdXncKcULnBroBjszrjgwKisRXRJzTi9KZ/zC1AE1ns=; b=Z4oUD/2kl05VzywXcFtDb4q39cvt+3zmG6387BRAaYNAhlb0tQ4sq3KwWIiTk7nQNU HrkYQkdV0uOUoB/IA8cLzjiNS9rfW90P6auoqkMW1smHg++m25TTG65TH7Rcepe28/qg 3qrL2Wpol5jLRJ9tnGWkUUxxV0O8SHtF51ObSiHdfnBSxlYut843YBQKzWMgMF4VdGta irEuF0EYybaEoCAUmMo/WBl3exx6GM7GNPnWxhlD7HcMpdPnLoDhj39Wg0djQEty2/BT uFHTwr0i8G3U6JhOXFzTHT5qrDSZxBrgNzXd9gVYRgRV8kWZYGbgRU2YG7ajrLDtdKyG 4rbg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724434373; x=1725039173; h=content-transfer-encoding:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=HdXncKcULnBroBjszrjgwKisRXRJzTi9KZ/zC1AE1ns=; b=n0XQKtjNyCvg+pCfKS4lOv3jTPi1Ro+4yBZYE3b2gW3BpFHFclSm6GquxHykvx80z0 eBX2LZIUIK5d8gLhn6ukluTi75/y3sCyERjVf6cd+g7mN6PAeQPyYioQqa8F711zEKj/ Hr6VC557WFdkWbtuRwATh2IAsFVd+dINtXDmBTgHXhYIADZ6Ah4S1ae+uM3p1PCKYvoH of+N28ABQOlQ52TDBQslHJfcTrAQ/J4LUQ4CFnfL1kjuS9Kd9D0kjU9FAFF2UN5O9Rue gWLa91azO6ypqDHztnCHwOSGgPRtVF5QTnmFafeoEMSHelmrRufBtVIyjmGayelMYusi YdSw== X-Gm-Message-State: AOJu0YxqR8AXZxr5a7+/cvzPqD86+m7Lehp+4lyEMbe7Elzfpr3yxCn7 70aNuEqXvQpzSfv90GZOUqX1bKsgXKm+qy6RFw/kbRRE8Y/vJOrqH3VnpD9R+b7GPcgJVku9/hZ crsXhrxFfxMGwJd2waeIuzrXhBsQ6wod5xNY= X-Google-Smtp-Source: AGHT+IFyay5Wy1+QkGQY3NX3R0Icps/84O85g5KO+R6cjPhSzVbi61+178C7+3M+2xwqmfgPpP4uAeu8W+4E3Z/L/f4= X-Received: by 2002:a05:6214:4602:b0:6bf:9281:96b0 with SMTP id 6a1803df08f44-6c16dc93cbemr39033526d6.33.1724434372438; Fri, 23 Aug 2024 10:32:52 -0700 (PDT) Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net x-ms-reactions: disallow MIME-Version: 1.0 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> In-Reply-To: <63DAE337-B117-4380-8735-186DC30FE0B7@rwec.co.uk> Date: Fri, 23 Aug 2024 19:32:41 +0200 Message-ID: Subject: Re: [PHP-DEV] [Concept] Flip relative function lookup order (global, then local) To: PHP internals Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable From: tovilo.ilija@gmail.com (Ilija Tovilo) On Fri, Aug 23, 2024 at 5:49=E2=80=AFPM Rowan Tommins [IMSoP] wrote: > > Other proposals aim to shift that balance - leaving some inconsistency, b= ut less compatibility break. > > And most users don't object to using a leading backslash, they just (quit= e reasonably) have no idea what impact it has on the ability of the engine = to optimise their code. 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. 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. From reading the responses, it seems we have three primary camps: 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. 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. 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. 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). Ilija