Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:103500 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 84387 invoked from network); 26 Nov 2018 12:51:55 -0000 Received: from unknown (HELO mail-qt1-f172.google.com) (209.85.160.172) by pb1.pair.com with SMTP; 26 Nov 2018 12:51:55 -0000 Received: by mail-qt1-f172.google.com with SMTP id r14so16705253qtp.1 for ; Mon, 26 Nov 2018 01:15:15 -0800 (PST) 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; bh=RrPal1gSgmEo9sP6v1h4WoKS5fvQQCYrKLKA6CHDcIs=; b=sa+8D3N3vf8ctJ1LuOoDeM4E8oESwIUrlqJ9xEQEb2ZO40f+g2AYOfK/ugNJEqhvjt 7+Al9FHty3MsCA3Kieud+yRZv044hfzJxCAuokSNWA3tgrAdW44xXVSq0FwekT+vFqFa avNYeN3F+R75QrmLj54nFSycOQmPKpXJ7zJ0qxu/jEclgUUc60+15svV89AoIKiU3yJq S5to8QQCMI4APLw3+bv2I9s3Xc4Tm2STAr4RhHjsghB0FZHQWBIo0z2sEzjPCUFOiP2z IDb+/g1EvJ28HCvtSo2J6aoChfibkLik/1+Ky6qexiRxWwXJFVvvZnTfWrwgmiP+QAUM LwCw== 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; bh=RrPal1gSgmEo9sP6v1h4WoKS5fvQQCYrKLKA6CHDcIs=; b=rtE5d192uyydAUV4TxuUgX8JRuWxqy2grnRFUvcURQlccmA/8N3hVVhJK5mWVt9pxD NtvZBHd6HUs52OHiwVDD2kWX/FIWWW7cQVzHKsNGHakz0OThkE5dqxEKGLTP2dUiHYZO 9R3wzD9PvbauLcXiVS+d7tnzsvCUGXRt3DhPSlL+k9q/S9Owdn6ZqqXjGsFFQXmL5AW8 JsPOops5FQ8+lYkfkpCdi0CgTkkerbMfKQNTMc/VRfE9YZe1BiVbvpsRprmKPT7yUVrp 2Qu5qXy4nRQ2DmvoIpomg+R5H/C5CILHseV/eR21XeVwuh5PHJ7dVyFpFhERNasfVlEA HePg== X-Gm-Message-State: AGRZ1gKcg3WMlcqw2qnG3epIqT2Nn35NlvtwYS4bGc3HvyKMR7yoeTlo BDO4XBxYAYoQ52DorPa2pXLU+lp7UcS9UAQ3rx4fHyg2 X-Google-Smtp-Source: AJdET5fW/GMS10gP9Ic2z/hU8+OCNj+a1ItmSn2/Rki9qnHjqZ6oX65TzOgUUa3KtnFO9gBQ5X1+Wp6rLRE7XNkjr60= X-Received: by 2002:ac8:3f2d:: with SMTP id c42mr24880742qtk.33.1543223714945; Mon, 26 Nov 2018 01:15:14 -0800 (PST) MIME-Version: 1.0 References: <1cb7fecd-22ba-0ded-5bd6-e70208053012@gmail.com> <7f65012b-e26a-fb58-718b-b35569e53d03@gmail.com> In-Reply-To: Date: Mon, 26 Nov 2018 11:15:03 +0200 Message-ID: To: Internals Content-Type: multipart/alternative; boundary="000000000000569e83057b8dc549" Subject: declare(cache=0) - explanation (was: Re: [PHP-DEV] [mini-RFC] Disable opcache per script using "declare(cache=0)") From: vsuraski@gmail.com (Zeev Suraski) --000000000000569e83057b8dc549 Content-Type: text/plain; charset="UTF-8" On Sun, Nov 25, 2018 at 11:43 PM Marco Pivetta wrote: > Is that space rrrrrrreeeeeally a problem? > > Take the example ZF loader from the RFC: that barely makes any difference > at all. > > A stronger reasoning for another language construct (that changes engine > behaviour) is kinfa required. > The emails I've written on this thread already suggested that I tend to agree. I just spoke with Dmitry to better understand why he cared about so little space, and turns out he didn't either - the rationale is different and is pretty straightforward. The goal of declare(cache=0) would be to avoid persisting utility functions/classes that have to do with a particular preload.php implementation - so that they don't become a part of the app's memory context and 'pollute' its scope. For example, you may implement a preload_file() function in preload.php, or perhaps even a class Preload{} with some utility functions that will be responsible for include()ing all the various files you want to preload into your server. Currently, function preload_file() / class Preload would become permanent parts of the app's scope - and pollute it to some degree. They're sort of meta-code that has no business sticking around in the app's memory space once the preloading stage is over. With declare(cache=0) - these will execute just as before, but won't be persisted into the permanent scope (or into the OPcache at all, for that matter). There's no way to 'automatically' apply this 'do-not-cache', as in different implementations - the preload.php file might actually include classes/functions folks would actually want to persist, and in other cases files include()ed by preload.php may in fact include functions/classes people do not want to persist. This has to be a manually-applied feature. As I mentioned in another reply on this thread, it's also a nice runtime/configurationless alternative for the blacklist feature, in case you want to prevent certain files from being cached for whatever reason (that use case is unrelated to the preload capability). I'm personally fine with this being admitted w/o a full fledged RFC if there are no objections. Zeev --000000000000569e83057b8dc549--