Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:113984 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 72819 invoked from network); 7 Apr 2021 09:06:28 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 7 Apr 2021 09:06:28 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id C7E1B180507 for ; Wed, 7 Apr 2021 02:05:41 -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=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,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-wr1-f52.google.com (mail-wr1-f52.google.com [209.85.221.52]) (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 ; Wed, 7 Apr 2021 02:05:40 -0700 (PDT) Received: by mail-wr1-f52.google.com with SMTP id f6so11001825wrv.12 for ; Wed, 07 Apr 2021 02:05:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=seld.be; s=google; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-transfer-encoding:content-language; bh=Ay7UevuFGaeE1Q07sUI2saCbVhjE3S7JgSidvevk+G4=; b=ByE10Ffd+pxWpgSQZrzmn/E444iCLMVrwwO2yLIfQ1DgmBbHBROc5/lixt9jzD8F0z oin+CAHwk2jC0Q8rN5ZA6z153n/IoBAQxuGoHZ+baXRE3ekBkdm24DY3MZXZMv0lXMIv h8uFU4jV6kUWQibq/AMmxMiikxfn1hT8cJCo+eSFXG3U2srELemKvXgS7MbIKzEBeOWO nrROPcMTg4/TGAOkfRjZFwccWA1YLJRyjLYa8pPBUvaF3dliZnnj2N2YDBaLhW2Kg3xE dCGTqmZ7xgd7tsuzgCWjVbhyhjWnifd70N1RBbQ4x1/p2/nt5Q0qBdLbE1mbrjv8M0+v RpVw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding :content-language; bh=Ay7UevuFGaeE1Q07sUI2saCbVhjE3S7JgSidvevk+G4=; b=NV/NNirFBLgaKWLFvGhXECf33E6WS93k0se4wxAmD7bfWYl9hmb9N/d/cCpiM5K4an uLt0ILXJfmcGtLIQFyrRrTChobbdUZwiyiMtjCJdronWZeJpGb0SzsQUc9NeSJTM/bBd SCilV3lqGFOIpgtwjB0c1tdBLdrPJKhzrkz1mEyZ19iee3t99zg2rLnGt10vvQiu+WeQ lkuapLR3iRz0rMu2lUloVo9gO7gfGAVHmLPwfHDxzrmLz8Hu/jZRlo8W3ukZKhvYU8oE r6CulTpNzU2NOPCbIiMJOzh2E2MIAUdGJ88go5priRkPZHZVaWofTxkzlpi1itfElf+O XFWg== X-Gm-Message-State: AOAM531w9jL3WADfxuqpjFJvEc6OXxE2ao8I8G8qGlLppEPPHojD0Ou9 dvRsCTJE+T5UwuL9xtSgjze0vA00XpCT1A== X-Google-Smtp-Source: ABdhPJysvlBPgXcfpwUovUgeQHAKlcTBC+3wRgjwUQE2NsIdbdJ5xOUREFTBzqGihb9xflbRrzlOmA== X-Received: by 2002:adf:9243:: with SMTP id 61mr3034985wrj.11.1617786338493; Wed, 07 Apr 2021 02:05:38 -0700 (PDT) Received: from ?IPv6:2a02:168:4b6e:0:f9:9cfa:49e4:6fb6? ([2a02:168:4b6e:0:f9:9cfa:49e4:6fb6]) by smtp.gmail.com with ESMTPSA id x1sm27424060wro.66.2021.04.07.02.05.37 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 07 Apr 2021 02:05:37 -0700 (PDT) To: internals@lists.php.net References: <606b899b.1c69fb81.8d941.72beSMTPIN_ADDED_MISSING@mx.google.com> Message-ID: <27144603-7a8c-be3d-72f2-3e9246d4da85@seld.be> Date: Wed, 7 Apr 2021 11:05:36 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.9.0 MIME-Version: 1.0 In-Reply-To: <606b899b.1c69fb81.8d941.72beSMTPIN_ADDED_MISSING@mx.google.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US Subject: Re: [PHP-DEV] Re: [RFC] Autoloader Classmap From: j.boggiano@seld.be (Jordi Boggiano) 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