Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:107973 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 38688 invoked from network); 3 Jan 2020 16:35:02 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 3 Jan 2020 16:35:02 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 1FA8E1804A8 for ; Fri, 3 Jan 2020 06:39:12 -0800 (PST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS, SPF_PASS autolearn=no autolearn_force=no version=3.4.2 X-Spam-ASN: AS8075 40.64.0.0/10 X-Spam-Virus: No X-Envelope-From: Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10olkn2087.outbound.protection.outlook.com [40.92.41.87]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Fri, 3 Jan 2020 06:39:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=duB4qD2EYDAIT2oafk1D2UKOXafk2ndeJdxme0guob6r8BEqu6ncM25IfhOSURdjgPbQZXZf0Q5ZxfIzPiBO51MZgiFU69kIvkMrVMuNGSfRNVV8kd5uDGV2j7FLTbSS0qzhgr7Zpfgu8QU31FTcLHLz+ioOV1L0sCqpyQM3KxXsfSNjLZuasC3arS1O13WcDGq/ubN7JzWyefjoYSnk378inHiPHDxbzV4KcDj2mvCAi1F4IS6w0hdyY+lzd1pMeeVF7tShSxSjYhvV2OKDpA5Bj+8YC6xElo9GRUtqepRX1vjgXSIGPUCxVJtRZ2z+dB5niE7iXUvTbPx62CY87g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=BkTzj9cAvsXz3aJZuacwM5JaBQ+v+rEi1Di8/hzDlhQ=; b=fMCK4FTYXN8J367eFW/JADYqh6GpZ9NJJ4lL8pshWYmt22QuEjSZ2GbPtzhYjD+zoUE72V+LU42RG8c/um8GfawLCV7gIBdmVdbvlAdRyaRVEVyP0wzKBR8rYwShXwzU9W/WLsT/3xZ+G40i8Xli8/KFRDWNX7+MFxAxGUg30PdlvxmQ+eJwEMhsCJQmp+/nYGMRJiZ2NMlChrz6tKnUg6CUKsvXa9eZgoUg/U8gQ830zXYSpS9nPXUoIOKLuXHCvDU5o7JvSEG8py38lGGZEviAdqK4xT7Sxn5CNPXYd069PLqX2t1sItahjbyo2lgMG8hqUiKLL2V+W8cEAE5cew== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=hotmail.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=BkTzj9cAvsXz3aJZuacwM5JaBQ+v+rEi1Di8/hzDlhQ=; b=gO0/2fcktPoTacRT6RnGO4Wk/mubTZL0vOuURHd5Xd2+0dyJVeI83OuPx5gN1wEJBmMLTb+doeDRt6BctvHeeownOnuhN4Ae61UorI9gZaKQznYnTU0x4sIJpCvlcFFopIHVQaqxcg+v4wopQGdSV+DbGGt+QfC5k0xEvAldYY7JagYsy90mkBBb/T8bxXL2U8urhUsObRXM6qnu++0cx2tWffKvKkmryIQlnGoPftyuRhnHz7jkWgbC8vVY0KueGG6Qa6dBXinZgRWxLSWwKwrUU2Kixv7So3k0djhfm1ydAaUpdjs2VRJwnHoOjA6x3EZu8vxS1PQdtJjkhPvzlA== Received: from MW2NAM10FT012.eop-nam10.prod.protection.outlook.com (10.13.154.56) by MW2NAM10HT213.eop-nam10.prod.protection.outlook.com (10.13.154.250) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2602.11; Fri, 3 Jan 2020 14:39:09 +0000 Received: from DM5PR07MB3067.namprd07.prod.outlook.com (10.13.154.56) by MW2NAM10FT012.mail.protection.outlook.com (10.13.154.222) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2602.11 via Frontend Transport; Fri, 3 Jan 2020 14:39:09 +0000 Received: from DM5PR07MB3067.namprd07.prod.outlook.com ([fe80::29e3:53bf:163e:5beb]) by DM5PR07MB3067.namprd07.prod.outlook.com ([fe80::29e3:53bf:163e:5beb%3]) with mapi id 15.20.2602.012; Fri, 3 Jan 2020 14:39:09 +0000 To: Rowan Tommins , "internals@lists.php.net" Thread-Topic: [PHP-DEV] Autoloading functions/consts without a performance impact Thread-Index: AQHVwdV5EmiXz0tOK0a5kq9yFNlY0qfY/a8AgAABdgQ= Date: Fri, 3 Jan 2020 14:39:09 +0000 Message-ID: References: , In-Reply-To: Accept-Language: en-CA, en-US Content-Language: en-CA X-MS-Has-Attach: X-MS-TNEF-Correlator: x-incomingtopheadermarker: OriginalChecksum:E8AEBA571EEFDFDE4480411235F6BE7D68F5CC435FF511A21E4942EE76769414;UpperCasedChecksum:7D9EA8A5D94CB4361B363EC82E371FBADE9F88C50B0B03A36462BFCE810DB81C;SizeAsReceived:7263;Count:45 x-ms-exchange-messagesentrepresentingtype: 1 x-tmn: [BatEwZPhyBb6ymi45KGMtY665tFXX0jZHrZZ8T26ZDk3PKjhurTTYIL/s34gF/Hh] x-ms-publictraffictype: Email x-incomingheadercount: 45 x-eopattributedmessage: 0 x-ms-office365-filtering-correlation-id: 5e6d3fa9-c76d-4dd5-0437-08d7905ab1a3 x-ms-traffictypediagnostic: MW2NAM10HT213: x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: /jibga1U3sQepnLFSvsFGr1gcK0137Xk2aaPIh632QC3RFEY3RqGZiXDk7eqVUg7L+W6xzcOzkcm14ejcmiGqsY7kbKioKmcLJ4Dd8e5HIKK0HlCIdJ4rY+Dqa0t0VhwqxW/IHe8uyL0ZITMp89ggsWuKcoj1R/38a01QCyeTB3dIviCRkG8xv+iRLtrpznQ x-ms-exchange-transport-forked: True Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: hotmail.com X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-CrossTenant-Network-Message-Id: 5e6d3fa9-c76d-4dd5-0437-08d7905ab1a3 X-MS-Exchange-CrossTenant-rms-persistedconsumerorg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-CrossTenant-originalarrivaltime: 03 Jan 2020 14:39:09.7511 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Internet X-MS-Exchange-CrossTenant-id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW2NAM10HT213 Subject: Re: [PHP-DEV] Autoloading functions/consts without a performance impact From: tysonandre775@hotmail.com (tyson andre) > If we cache the resolution to global function at line 2, removing that li= ne=0A= > changes the rest of the program. If we don't cache it there, then what=0A= > happens if we run this code in a loop?=0A= =0A= It (and my proposed autoloader change)=0A= changes it for that call (at that opcode, i.e. for the call at that line an= d column).=0A= PHP's caching does not cache it for other calls within the same file.=0A= If that call opcode was within a function or loop, however,=0A= subsequent calls would use the cached resolution.=0A= =0A= > namespace Foo;=0A= > echo strlen('hello'); // Finds a global function at step 2, so doesn't=0A= > trigger the autoloader=0A= > echo \Foo\strlen('hello'); // Explicitly namespaced function, so triggers= =0A= > the autoloader=0A= > echo strlen('hello'); // Should this run \strlen or Foo\strlen?=0A= =0A= The example you were thinking of would call \strlen on line 2, \Foo\strlen = on line 3, and \Foo\strlen on line 4.=0A= (because the caching is per-opcode, not per-file or per-namespace)=0A= =0A= > We've never prioritized fixing this issue,=0A= > but implementing the proposed autoloading behavior would make fixing it e= ssentially impossible, as we certainly can't perform an autoloader invocati= on on each call.=0A= =0A= If we skip autoloading ambiguous calls in the current namespace,=0A= then we wouldn't have to perform an autoloader invocation every call,=0A= and the problem of fixing that bug would be unchanged.=0A= I marked step 3 as optional because there were arguments for/against it.=0A= =0A= -Tyson=