Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:113975 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 43536 invoked from network); 6 Apr 2021 05:12:19 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 6 Apr 2021 05:12:19 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 505DD1804F8 for ; Mon, 5 Apr 2021 22:11:15 -0700 (PDT) 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,SPF_HELO_NONE, SPF_PASS autolearn=no autolearn_force=no version=3.4.2 X-Spam-Virus: No X-Envelope-From: Received: from mail1.25mail.st (mail1.25mail.st [206.123.115.54]) (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 ; Mon, 5 Apr 2021 22:11:14 -0700 (PDT) Received: from home.th-ayu.reay.family (unknown [49.48.216.142]) by mail1.25mail.st (Postfix) with ESMTPSA id A270F60518; Tue, 6 Apr 2021 05:11:08 +0000 (UTC) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 13.4 \(3608.120.23.2.4\)) In-Reply-To: Date: Tue, 6 Apr 2021 12:11:05 +0700 Cc: Internals Content-Transfer-Encoding: quoted-printable Message-ID: <5C0EA9CE-0001-4507-81E1-7CAC9926D2DF@koalephant.com> References: To: Mark Randall X-Mailer: Apple Mail (2.3608.120.23.2.4) Subject: Re: [PHP-DEV] [RFC] Autoloader Classmap From: php-lists@koalephant.com (Stephen Reay) > On 6 Apr 2021, at 05:05, Mark Randall wrote: >=20 > On 15/03/2021 17:41, Mark Randall wrote: >> I would like to propose the addition of a new mechanism of = autoloading classes - a classmap that will be consulted prior to = checking the spl_autoload_register'd callbacks. >> https://wiki.php.net/rfc/autoload_classmap >=20 > Does anyone else have any more feedback on this? If not I plan on = opening voting in a couple of weeks or so. >=20 > The tl;dr: >=20 > * Autoloading is one of the routines called most frequently in any = request. >=20 > * It's a very minor boost in autoloading performance, around 5% vs = invoking a userland function. This will easily be swamped by any IO and = invalidated entirely by preloading. >=20 > * I expect 99.9999% of users will never know it exists, and it will = instead just be an option for tools like composer that will provide a = small transparent boost. >=20 > * It provides a very minor benefit to debugging as you get to skip = over the autoloading frames which so very often come up during a = request. >=20 >=20 > --=20 > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: https://www.php.net/unsub.php >=20 Hi Mark, Just to clarify something - wouldn't the loader use =E2=80=98require=E2=80= =99 behaviour, not =E2=80=98require_once=E2=80=99 behaviour? If you=E2=80=99= re hitting the autoloader, that means the class in the file you=E2=80=99re= about to load isn=E2=80=99t defined yet, which means the file hasn=E2=80=99= t been loaded already. Using require_once you=E2=80=99d be doing a check = if the file has loaded in a scenario where it would have never been = loaded anyway. Cheers Stephen=20=