Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:73026 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 6578 invoked from network); 9 Mar 2014 08:35:46 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 9 Mar 2014 08:35:46 -0000 Authentication-Results: pb1.pair.com header.from=bof@bof.de; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=bof@bof.de; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain bof.de designates 80.242.145.70 as permitted sender) X-PHP-List-Original-Sender: bof@bof.de X-Host-Fingerprint: 80.242.145.70 mars.intermailgate.com Received: from [80.242.145.70] ([80.242.145.70:41386] helo=mars.intermailgate.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 6A/E2-18839-0E72C135 for ; Sun, 09 Mar 2014 03:35:45 -0500 Received: (qmail 21310 invoked by uid 1009); 9 Mar 2014 09:35:40 +0100 Received: from 209.85.216.41 by mars (envelope-from , uid 89) with qmail-scanner-1.25-st-qms (clamdscan: 0.96.2/18557. spamassassin: 3.3.1. perlscan: 1.25-st-qms. Clear:RC:1(209.85.216.41):. Processed in 0.07708 secs); 09 Mar 2014 08:35:40 -0000 X-Antivirus-MYDOMAIN-Mail-From: bof@bof.de via mars X-Antivirus-MYDOMAIN: 1.25-st-qms (Clear:RC:1(209.85.216.41):. Processed in 0.07708 secs Process 21303) Received: from mail-qa0-f41.google.com (gmail@bof.de@209.85.216.41) by mars.intermailgate.com with RC4-SHA encrypted SMTP; 9 Mar 2014 09:35:40 +0100 Received: by mail-qa0-f41.google.com with SMTP id j5so5854925qaq.0 for ; Sun, 09 Mar 2014 00:35:38 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=5q8Gyv9TPupNzjgZXtAEnOGVG93fiMVF94KLphW7dt0=; b=PDx+WJdkaoagD/IKW5t45DNYW5K505FBZUju22ZBpX0cFgLlg1lZer+rYddlNg6OQJ EhxrrR49QqTJqphqEeR+Eqt9/rod9aIVwgAhNlnzGAzIILeV4h/NzePrV/wKeF6T8sxZ d+Q0pWMhid1DzHWc9d97gRz14jgnXV4YN2Kc7OARZq19/jI5Zm5ycn8tizBEzMBO/FF0 Dt9mq0QFo7CB52pbFe6HBrQCveBPIQaYfUqsmY7W8kZ+cHcns48zY+AH76/VhLTaiFK9 VvTSOwd6qRbVQQxW1An2xBAATtv4Y0pmVQFWqiX3DB4rsMde7X5at147qq8hr0PDZubo szBg== MIME-Version: 1.0 X-Received: by 10.224.127.129 with SMTP id g1mr33275399qas.22.1394354138803; Sun, 09 Mar 2014 00:35:38 -0800 (PST) Received: by 10.140.41.208 with HTTP; Sun, 9 Mar 2014 00:35:38 -0800 (PST) Received: by 10.140.41.208 with HTTP; Sun, 9 Mar 2014 00:35:38 -0800 (PST) In-Reply-To: <531BFEF1.5000305@sugarcrm.com> References: <531BFEF1.5000305@sugarcrm.com> Date: Sun, 9 Mar 2014 09:35:38 +0100 Message-ID: To: Stas Malyshev Cc: internals , Marco Schuster Content-Type: multipart/alternative; boundary=001a11c1e05422920b04f4285f92 Subject: Re: [PHP-DEV] Idea: ifdef-like feature to ease userland BC From: bof@bof.de (Patrick Schaaf) --001a11c1e05422920b04f4285f92 Content-Type: text/plain; charset=ISO-8859-1 Am 09.03.2014 06:41 schrieb "Stas Malyshev" : > How is it supposed to be implemented? PHP has no separate "compile-time" > than can produce significant improvement in performance, like C-like > languages do, and given opcode caching, such conditions should either be > resolved statically - which means limited usability, as you'd have to > drive them off something that you can use no code to define, or use some > logic to resolve them dynamically, which logic would probably take > nearly as much time and space as regular if() would. Such compile-time optimization, especially regarding opcaches leaving out entire blocks of code completely for the rest of their livetime, can be sanely driven, as far as I can see, exactly for the set of constants that have already been defined at the end of MINIT. A single bit giving that meta information on the constant, would suffice to signal that possibility. That would basically be all constants defined by PHP core and loaded extensions, Which might already be, in my eye, a useful thing to support, providing dead block elimination for PHP version constant compares, tests that certain socket flags are present, and so on. To me (and others when they would use it), it would be even more useful when a "configurable constants" extension like PHP-Defcon (see github) is used. We use that to define diverse server-type constants on different servers all using the same PHP code base. Now, all that does not need new syntax - "just" a compile time evaluation of any branchy constant expression regarding "does it use only literals and constants already defined at the end of MINIT". Maybe I'm stupid to not know that APC and/or opcache already does that? Couldn't see it immediately so I thought I'd write the issue down. best regards Patrick --001a11c1e05422920b04f4285f92--