Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:70272 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 85513 invoked from network); 22 Nov 2013 01:20:02 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 22 Nov 2013 01:20:02 -0000 Authentication-Results: pb1.pair.com header.from=yohgaki@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=yohgaki@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.215.46 as permitted sender) X-PHP-List-Original-Sender: yohgaki@gmail.com X-Host-Fingerprint: 209.85.215.46 mail-la0-f46.google.com Received: from [209.85.215.46] ([209.85.215.46:43586] helo=mail-la0-f46.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 37/C1-09639-041BE825 for ; Thu, 21 Nov 2013 20:20:01 -0500 Received: by mail-la0-f46.google.com with SMTP id eh20so427988lab.5 for ; Thu, 21 Nov 2013 17:19:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc:content-type; bh=imvX+K//WxwLkYRyGgXBfKARhG/RxoRPq2gOBHKEh28=; b=KqukihLfDqaCVA+dbFGhF2ISNMFqWJdioftfNWG+v2EihmtxgOHKY3ejX2srQ+T6a+ Psk3BE4q8SpqgH7oREHsNejYgwzGRQHLGkA5xgzNR+EZ2hFD2J6PP6lObx3v2DjIBh59 XuHIBnsXR/H4j6Dd1y0IFsS9nD5FXIRkReEPE3tMxu6V2J10bmYj+GZUtsaCSWf454b+ D6EVkHNoLIcee6tkhBH0gtsC8b0QSndaYhwWE2yXl/AsIqCjqbgMcpzz1eBhIgNMjqT6 IFkoGYMu2QxLoS1vMM+A4xaBfw21uSN5g9n8Y0xZQE2t53I17N5EtlQdkzAo7vfHf6Hx yukg== X-Received: by 10.152.8.18 with SMTP id n18mr7396934laa.24.1385083197629; Thu, 21 Nov 2013 17:19:57 -0800 (PST) MIME-Version: 1.0 Sender: yohgaki@gmail.com Received: by 10.112.154.201 with HTTP; Thu, 21 Nov 2013 17:19:17 -0800 (PST) In-Reply-To: References: Date: Fri, 22 Nov 2013 10:19:17 +0900 X-Google-Sender-Auth: dzCVTyUTLuvkyGJosIdjygDGsVo Message-ID: To: Bob Weinand Cc: List PHP Mailing List Content-Type: multipart/alternative; boundary=001a11c34edefaac3104ebb9cf1b Subject: Re: [PHP-DEV] [RFC] [VOTE] Constant scalar expressions From: yohgaki@ohgaki.net (Yasuo Ohgaki) --001a11c34edefaac3104ebb9cf1b Content-Type: text/plain; charset=UTF-8 Hi all, On Fri, Nov 22, 2013 at 10:09 AM, Yasuo Ohgaki wrote: > Anyway, constant variables are useful for VM/op code optimization. > > include('foo.php'); // const a = 123; > const b = a; > > is allowed currently. We may restrict this behavior only to the same file, > so that VM/op code optimization can be done. > > Currently, no expression is allowed with 'const'. Defining 'const' using > another constant with the same value is useless. It's a bad coding > practice > in many case, I suppose. > > I understand use cases of scalar expressions with constants, but I'm > concerned > loosing door for further optimizations. (e.g. $x = $x + 123 is faster than > $x = $x + a, > where a is 123 in constant var hash) > > We may be better to restrict expressions with constants only to the same > file > even if we loose some benefits/flexibility in user code. > > Is this discussed? > I voted 'yes', but I change my mind. Sorry. If the RFC leaves door for constant optimization, I'll vote 'yes'. Constant look up is not a simple hash look up. Regards, -- Yasuo Ohgaki yohgaki@ohgaki.net --001a11c34edefaac3104ebb9cf1b--