Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:114069 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 25182 invoked from network); 19 Apr 2021 09:37:39 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 19 Apr 2021 09:37:39 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 1D70E1804F8 for ; Mon, 19 Apr 2021 02:39:54 -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=-0.2 required=5.0 tests=BAYES_40,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,HTML_MESSAGE, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.2 X-Spam-Virus: No X-Envelope-From: Received: from mail-lf1-f49.google.com (mail-lf1-f49.google.com [209.85.167.49]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Mon, 19 Apr 2021 02:39:53 -0700 (PDT) Received: by mail-lf1-f49.google.com with SMTP id r128so27922262lff.4 for ; Mon, 19 Apr 2021 02:39:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=ORRI9kHE3V8/5bmYOZ13W9oOkSBs2JL2ZIrlx9OC0P0=; b=RwacurraY3y0EnlCq7tdCs5jzjAmk/GnHUle7pvSa5MAgJsyHhcMplIeaXCxt0RGMX 7QcVn+uDiQoECT+/T318jVLnUnaZd/lInvzEz5ig8G49nbiDJXjRGO7eY/NDa+sUm+xs Xhp/1RqHJyaCi3FlIxrZVQf80j/c9FgnAF0/8SXgaMCAJRJn2A37Csmhbgtb6i4fhvwt 7Q5QqKwHVVAvMJmD55MTQUflRLnZAJghPACCqLtWWZ3knSG6ICNMVUyVAR3ZveqUy+89 jJ4ccbiCzoO4/5j78NxrWJ0eIvZ3S8aS07rHxUNzl/mgZf3PxWD+5qNSYvLfVybjszrB JpVA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=ORRI9kHE3V8/5bmYOZ13W9oOkSBs2JL2ZIrlx9OC0P0=; b=lFj7McgodWCJhFUjtz6404hNwbfeEYOvhMEooBCcriQ5DupLMvZfhgdr02mkh7sUus CnaBr7DmpKu30SjJaDwBg/hDseX8BMzDoezMzNddv5lyO1n0M3aJRRbkzK65audi8fQc UM9CuHW8Y40CjxMXWHyvYBcE76KewjYyTCn8VdD6XFWLzSNh5Ym1G0CYnrcdZnBxO3OQ 3xAVCTcd8Gce4vvHyEWdjSCE01D2JJocpLWm5nKIORpH4d9Z7DjfV3EMHUuOl2iAVt8/ bOQcwm7pxTh+U3ECrX1zl+6DNovGeJeUPP+m12jaCLbkCfdpNWBp4XTB+hwe8nho57l8 ATxw== X-Gm-Message-State: AOAM5326bfgoAjRMC58W+jN2tQiWW3Yd5viOQ7Xw75Y92pVc04eYKUWs 7O/YpjYzKo6jNBaV4KtKV1bN5V2YryGIE2TZ0eVHqUbiw8w= X-Google-Smtp-Source: ABdhPJyqGVHjxdn4ERZYL9hHGlsqlnfH2FWWoTEn++arlLuU6HBBHvlr8wgratlTcGRIEwJtTTELsTA8h5OCDs1ZcKk= X-Received: by 2002:ac2:4e93:: with SMTP id o19mr7910638lfr.485.1618825186831; Mon, 19 Apr 2021 02:39:46 -0700 (PDT) MIME-Version: 1.0 References: <606b899b.1c69fb81.8d941.72beSMTPIN_ADDED_MISSING@mx.google.com> <27144603-7a8c-be3d-72f2-3e9246d4da85@seld.be> In-Reply-To: <27144603-7a8c-be3d-72f2-3e9246d4da85@seld.be> Date: Mon, 19 Apr 2021 11:39:30 +0200 Message-ID: To: Jordi Boggiano Cc: PHP internals Content-Type: multipart/alternative; boundary="00000000000036f10c05c0501c0d" Subject: Re: [PHP-DEV] Re: [RFC] Autoloader Classmap From: nikita.ppv@gmail.com (Nikita Popov) --00000000000036f10c05c0501c0d Content-Type: text/plain; charset="UTF-8" On Wed, Apr 7, 2021 at 11:06 AM Jordi Boggiano wrote: > Hi Mark, > > On 06/04/2021 00:05, Mark Randall wrote: > > > > * 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. > > > I wrote this as feedback in your early round (I don't think you > answered), and IMO it still stands: > > // > > The proposed API should really support > multiple maps. Composer has a prepend-autoloader option which controls > whether the generated autoloader will be prepended or appended when > spl_autoload_register is called. This is required in some cases where > multiple autoloaders coexist. So the ability to add multiple maps, > including optionally prepending them would be a must IMO. The ability to > remove an autoloader and its associated classmap would also be very > welcome so one can unregister things cleanly. > > So taking the above in consideration, and keeping consistency with > existing spl_* functions in mind, I would propose an API more like: > > autoload_register_classmap(array $map, bool $prepend = false) > autoload_unregister_classmap(array $map) > > // > > Given the current API proposal, I think I would vote no, because I do > not know how I'd even implement this in Composer without making a mess > in case multiple autoloaders co-exist (which one can not know about at > autoload generation time). We'd have to perhaps set the classmap on the > first autoloader, and if a second autoloader gets created it'd wipe the > classmap entirely and skip the optimization for safety because it > becomes unmanageable otherwise. > > > > * 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. > > > In development environment we do not recommend using an optimized > autoloader as it slows down updates/installs and doesn't bring a ton of > perf benefit, so this argument isn't that strong. > > Best, > Jordi > I think this RFC really needs an implementation in composer (i.e. a reviewed PR) before it can go to vote. It would be entirely pointless if this were implemented, and it then turned out that composer couldn't actually use it. Nikita --00000000000036f10c05c0501c0d--