Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:83572 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 64370 invoked from network); 23 Feb 2015 14:14:19 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 23 Feb 2015 14:14:19 -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.215.50 as permitted sender) X-PHP-List-Original-Sender: ircmaxell@gmail.com X-Host-Fingerprint: 209.85.215.50 mail-la0-f50.google.com Received: from [209.85.215.50] ([209.85.215.50:40566] helo=mail-la0-f50.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id AA/11-01128-9B53BE45 for ; Mon, 23 Feb 2015 09:14:19 -0500 Received: by labgd6 with SMTP id gd6so18524458lab.7 for ; Mon, 23 Feb 2015 06:14:14 -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=nSGFYjWYLaIBSzSbCYswUuUriI/1BkCnAYSpmED566U=; b=BQZSQCmwHwfc32Kmo2MO27h1pNTU7DposoQvsq4MjE2odIQDH1Dz7DvGlik/F45tpK vUAP1uqBK+w1oD9IYJ1Ry1B9POBDkcF2tDUDqT5hPYuv+lIls7cwJIBxd9+8GpowwbFK TuS7Yg1a4/Wy5Tcy2khxXCXfOjTRSdQOGs0aExlHubftSl0l1NStGwKgQg5I5lYlePMu sB1u5m+bc/diqNhSQgW27oaJ332DQGl3QrxAZs9kCUSVah/WWzE5kIub9I+eNFQGGvw6 BJAby1nPJoCWz+e0+Sa5vjx4eoo/nWv6zXQ05ev5Bu0TfUt+sd33mz6RVwHtfj2YW9xk Pasg== MIME-Version: 1.0 X-Received: by 10.112.136.201 with SMTP id qc9mr10040420lbb.57.1424700854195; Mon, 23 Feb 2015 06:14:14 -0800 (PST) Received: by 10.25.43.9 with HTTP; Mon, 23 Feb 2015 06:14:14 -0800 (PST) In-Reply-To: <214184933573e0242e6d2bfe753bea8d@mail.gmail.com> References: <2e4694f9805ee81ea0b2c79eab06c2d6@mail.gmail.com> <54EA5EDA.8010605@gmail.com> <54EA6A99.5010609@gmail.com> <54EA7F15.9030606@gmail.com> <54EA891B.6030405@gmail.com> <09b9ee836c04b1750614a91bd39a5bed@mail.gmail.com> <54EA97A2.4010701@gmail.com> <661590f4daa710176268b43c1b950583@mail.gmail.com> <214184933573e0242e6d2bfe753bea8d@mail.gmail.com> Date: Mon, 23 Feb 2015 09:14:14 -0500 Message-ID: To: Zeev Suraski Cc: Joe Watkins , PHP internals Content-Type: text/plain; charset=UTF-8 Subject: Re: [PHP-DEV] JIT (was RE: [PHP-DEV] Coercive Scalar Type Hints RFC) From: ircmaxell@gmail.com (Anthony Ferrara) Zeev, >> Maybe I'm ignorant of something, but isn't the only way you can begin to >> infer the type with real confidence is by having strict typed parameters ? > > Not at all. You can definitely infer lots of type information without any > type hints, strict or weak. bench.php wouldn't be 25x faster and Mandelbrot > would not be as fast as an equivalent C program if we couldn't infer types > without type hints. Take a look at it (Zend/bench.php) - much like you can, > as a human, figure out that $i is an integer, and that $recen is a float, > etc. - you can write code that will do that automatically (by taking a look > at the assigned values, at the operators which are used, etc.) In general. Yes, but mandel() from bench.php isn't generic code. It is a subset of valid code. One that wouldn't need any changes to move to strict mode. Additionally: "would not be as fast as an equivalent C program". I compiled mandel() using C (via PECL). It wasn't 25x faster, it was 75734.13830x faster (3000x with -O0). So no, you're way off from C speed. > If you haven't, please read my reply to Jefferson from yesterday: > marc.info/?l=php-internals&m=142463029832159&w=2 > It illustrates the point as to why not only are strict types not necessary > to do type inference, they also don't provide you with additional data that > can help you generate better code *assuming the same input source code*. > The bets are off if you change your code and compare how the changed version > runs in the Strict mode and the unmodified one runs in Coercive. But if you > take the modified code and run it on both Strict and Coercive - you can > reach the same results (except for the obvious, intentional functionality > differences). Again, please make it clear to people that you're talking about special cases of userland code, where the rest of us are talking about general cases. Anthony