Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:127493 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 lists.php.net (Postfix) with ESMTPS id 862F11A00BC for ; Wed, 28 May 2025 07:30:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1748417295; bh=9Kw6uVOtxmF0xodeOrmtycX8Xix9vVyaOXSHEnljoK0=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=E/O9LCoQFEeI5uSC+0NKW16A7x6g4qm91e8AfdsonMA7FNXJQ+hc5q8yfQP9svLYU CQ7qeeZmod5bRXDXfbddqMnfnH3f86Kysn6FOLSJ65OXDF9bRiJDmd1zUlNItUARkQ i5YPbCud+g4Db9A/1dqk4LeH1LbuTTFWulE6vueRbWNz5iKx8it7HYw5TN9p3cl2AG us2bs9/qKsViRxxi3QCQlL+GXRezxwhpLmt6+1wMJPMayZ+dGk5O9CJMtUp2t/ex// 6F2GfNU38PLA5A4Wyb30kedVRehzf6ETaApgbyuXjGBP7/lvzXGGCltVUDAVmL+Onb AAbXkrFue88tA== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 9A130180381 for ; Wed, 28 May 2025 07:28:14 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) 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,DMARC_PASS,SPF_HELO_NONE, SPF_PASS autolearn=no autolearn_force=no version=4.0.1 X-Spam-Virus: Error (Cannot connect to unix socket '/var/run/clamav/clamd.ctl': connect: Connection refused) X-Envelope-From: Received: from chrono.xqk7.com (chrono.xqk7.com [176.9.45.72]) (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 ; Wed, 28 May 2025 07:28:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bastelstu.be; s=mail20171119; t=1748417418; bh=nni9h0BMX3ilfMHuY3WJpLZHuwKbQ6lxaCQEVnaAZlk=; h=MIME-Version:Date:From:To:Cc:Subject:In-Reply-To:References: Message-ID:Content-Type:from:to:cc:subject:message-id; b=FJtXUC5PH2l/1Kh9GnNHNCSctBOqTxEy5lRn8KyVqxB6JxCta1Ct5BYy0w9Dj7joL wSjn9qMudG8LbcPLGp9hqdlbDyP8i0iWtZgMAiqr2pkLm16B+vjFPtZvhA8oNBDH02 w9X23b93WYu9NI/ppU3Z1lRX2jasW+Y+BTxILJbYaMw3K/yZqxxvlb/Z+IKr5otgWd V18wSV1k+FcUpyG2pTTeN+/uF/oPRZ2GwhX+uCjDDwNOMj5N3xAtWPmeBY515zraCY ePXTOHx+gLEU78HX5U7hhJrCvyacQP1xhWk9EEqhjMTDLSybwRhWCWWSzB7rX5Yp5w hkP9E7JYSeFsQ== Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net x-ms-reactions: disallow MIME-Version: 1.0 Date: Wed, 28 May 2025 09:30:18 +0200 To: Levi Morrison Cc: php internals , Ilija Tovilo , Arnaud Le Blanc Subject: Re: [PHP-DEV] [RFC] Make OPcache a non-optional part of PHP In-Reply-To: References: <7bdbd839b20d233e26e7901ae093ce1b@bastelstu.be> Message-ID: <5155aaaaee5dcb91b6eac20db9ea8275@bastelstu.be> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit From: tim@bastelstu.be (=?UTF-8?Q?Tim_D=C3=BCsterhus?=) Hi Am 2025-05-27 20:07, schrieb Levi Morrison: > If opcache can still be disabled, and isn't enabled by default in CLI, > then > in practice we still have all of these issues. The engine may not have > to > care about "is opcache around?" but it still has to care "is opcache > enabled?" Dropping the first part isn't that helpful if the second part > still > has to be asked. Sebastian's response is quite accurate. While it is true that it will still be necessary to test the different code-paths, there is no single thing “OPcache”. It is rather a collection of assorted features that need to integrate into the engine by hooking into a small number of hooks (replacing some function pointers). By allowing a tighter integration with the engine, the OPcache-specific logic can be guarded by simple `if (caching_enabled)` or `if (optimizer_enabled)` statements, allowing a more direct data flow by means of local variables instead of being restricted to some kind of “middleware-style” wrapping of the original logic, possibly duplicating some of it by copy and paste. By having the entire logic in a single place it also becomes easier to see if it would be necessary to make some changes to the caching when modifying the compilation, this is also true for a code reviewer might be able to point out logic mistakes more easily. And of course in the future some of the `if()` statements might also be removed entirely when it turns out that the logic guarded by them does not have any drawbacks or the default values of INI settings can be updated. Long story short: By integrating OPcache directly into the engine, we can only gain some maintenance flexibility. In the worst case, we are in no worse situation than currently and it can only get better from there. And of course there's also the benefits to the users of PHP, since less configuration will be required for a production set-up. If OPcache is always loaded, it means that it will also be enabled by default for FPM set-ups, since `opcache.enable` defaults to `1`. Best regards Tim Düsterhus PS: Did you know that OPcache can optionally replace (opcache.enable_file_override) the implementation for the `file_exists()` function, amongst others? I did not until recently.