Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:83256 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 65272 invoked from network); 20 Feb 2015 01:57:37 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 20 Feb 2015 01:57:37 -0000 Authentication-Results: pb1.pair.com smtp.mail=ircmaxell@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=ircmaxell@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.217.174 as permitted sender) X-PHP-List-Original-Sender: ircmaxell@gmail.com X-Host-Fingerprint: 209.85.217.174 mail-lb0-f174.google.com Received: from [209.85.217.174] ([209.85.217.174:32968] helo=mail-lb0-f174.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 11/00-65128-09496E45 for ; Thu, 19 Feb 2015 20:57:36 -0500 Received: by lbvp9 with SMTP id p9so3658012lbv.0 for ; Thu, 19 Feb 2015 17:57:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=B9LXYPWCAyRGbA7XNZ0YkvaUbHqPpdTs/KbrTcV+5mM=; b=bQRknSiTFETjnq2dqEvm431JodXDUmKkEqx8GZMB1mMCPCmE/THe97kgIUjB5iU+Gb OZv91LhO73FWSVZPWpkhtv8yYW3ho3o4XNX3AG5q5DR+0QF+W9OQE70RpDpnaN/d4t6A BqW+TadGSUopqeHQzlxdZjdKr2YSczBowM0NGGMcs7cuWzbLX+LuhzwqOikxTUQZNhMJ e1lFpyXbHg3p8uzE6On/d8wfJBTvCLyDcCBt4mOqLHmJtw9syjbRjLZiNbDmnF3sZ28S xoFOLQAmCf1B1pTWQ8tMsHUeZ/xZ0BViXoBDkiV5sOs0j2q7a4yPYFj5nO1TGOt86ZVP 7Jfw== MIME-Version: 1.0 X-Received: by 10.152.5.72 with SMTP id q8mr6482892laq.57.1424397453341; Thu, 19 Feb 2015 17:57:33 -0800 (PST) Received: by 10.25.43.9 with HTTP; Thu, 19 Feb 2015 17:57:33 -0800 (PST) In-Reply-To: <54E66569.8000709@garfieldtech.com> References: <011801d04a07$83ab1c00$8b015400$@php.net> <016f01d04a3a$e9183220$bb489660$@php.net> <022801d04ab1$4a0c47d0$de24d770$@php.net> <1913e09d7f52541901d8574d2080a63f@mail.gmail.com> <7a5d96b34b98ec1f3ee17be7fa6a1e81@mail.gmail.com> <2CBDEB67-3DE3-437D-9AF3-0E6A92027244@zend.com> <4cc0c81c7199a452534bb8edcdb19914@mail.gmail.com> <54E589F6.9030002@garfieldtech.com> <54E66569.8000709@garfieldtech.com> Date: Thu, 19 Feb 2015 20:57:33 -0500 Message-ID: To: Larry Garfield Cc: "internals@lists.php.net" Content-Type: text/plain; charset=UTF-8 Subject: Re: [PHP-DEV] Reviving scalar type hints From: ircmaxell@gmail.com (Anthony Ferrara) Larry, > Anthony, can you expand here at all about the practical benefits of > strong-typing for variable passing for the compiler? That seems to be the > main point of contention: Whether or not there are real, practical benefits > to be had in the compiler of knowing that a call will be in "strict mode". > (If there are, then the split-mode makes sense If there are not, then > there's little benefit to it.) For the normal compiler & engine there will be no benefit for the foreseeable future. For a tracing JIT compiler, there will be no advantage. For a local JIT compiler, there can be some optimizations around reduced conversion logic generated (and hence potentially better cache efficiency, etc). A guard would still be generated, but that's a single branch rather than the full cast logic. This would likely be a small gain (likely less than 1%, possibly significantly less). For a AOT compiler (optimizing compiler), more optimizations and therefore gains can be had. The big difference here is that type assertions can be done at compile time. So that means one less branch (no guard) per argument per function call. In addition, native calls can be used in a lot of cases, which means the compiled code doesn't even need to know about a zval (significant memory and access reduction). This has potential to be significant. Not to mention the other optimizations that are possible. However, I think making this decision based on performance is the incorrect way of doing it. For the Zend engine, there will be no discernible difference between the proposals. It's a red herring. The difference I would focus on is the ability to statically analyze the code (with the benefits that comes with). Anthony