Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:83608 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 42463 invoked from network); 23 Feb 2015 20:57:20 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 23 Feb 2015 20:57:20 -0000 Authentication-Results: pb1.pair.com header.from=pierre.php@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=pierre.php@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.216.182 as permitted sender) X-PHP-List-Original-Sender: pierre.php@gmail.com X-Host-Fingerprint: 209.85.216.182 mail-qc0-f182.google.com Received: from [209.85.216.182] ([209.85.216.182:37836] helo=mail-qc0-f182.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id D1/7F-01128-F249BE45 for ; Mon, 23 Feb 2015 15:57:20 -0500 Received: by qcrw7 with SMTP id w7so13190657qcr.4 for ; Mon, 23 Feb 2015 12:57:17 -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=S4+rUvMUrhSJH6mQ3o2feoWvgY5ocZuZVfeSNRCybPQ=; b=YJgsNN37JYxyT4GRiDnoDxsmNh+3nHj+NM8eI2ZCx2g5OlVtC8sqHhveJqXyOMd81F fnwFXVNbjOOEk+vtj1dOYzhYsB45XZXHHcsyJg4B9H4MDa2PAekoqZCrAcZxCxi1GCxV TbH5XEuMFuUS0I7O8TSWkDyZAop2o2b7EiBXaIRK3EquM2roMtwBTV85OWKIPYMMgFP7 MdhaOu7o3NU1/auL1aXbPv21kTPGEKhn2RtfihhliqmdTF+vJpH3lb+q9udFRoTk3Mle 3JDxgalVo6Oo86W5D85mqzcGUVKheL9hPBCZuuN/OD7mAOlFpSYzgjYKkhias2xZMXMc u9bA== MIME-Version: 1.0 X-Received: by 10.140.100.169 with SMTP id s38mr26190371qge.96.1424725037326; Mon, 23 Feb 2015 12:57:17 -0800 (PST) Received: by 10.96.39.195 with HTTP; Mon, 23 Feb 2015 12:57:17 -0800 (PST) Received: by 10.96.39.195 with HTTP; Mon, 23 Feb 2015 12:57:17 -0800 (PST) In-Reply-To: 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 12:57:17 -0800 Message-ID: To: Zeev Suraski Cc: Joe Watkins , Anthony Ferrara , PHP internals Content-Type: multipart/alternative; boundary=001a1134f158c0a6ca050fc7a52e Subject: RE: [PHP-DEV] JIT (was RE: [PHP-DEV] Coercive Scalar Type Hints RFC) From: pierre.php@gmail.com (Pierre Joye) --001a1134f158c0a6ca050fc7a52e Content-Type: text/plain; charset=UTF-8 On Feb 23, 2015 7:43 AM, "Zeev Suraski" wrote: > > > -----Original Message----- > > From: Anthony Ferrara [mailto:ircmaxell@gmail.com] > > Sent: Monday, February 23, 2015 4:14 PM > > To: Zeev Suraski > > Cc: Joe Watkins; PHP internals > > Subject: Re: [PHP-DEV] JIT (was RE: [PHP-DEV] Coercive Scalar Type Hints > > RFC) > > > > 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. > > I'm not sure what that means. mandel() is an example in the very same way > that foo() and bar() you presented were examples. It also happens to be a > real world example showing Joe that not only is it possible to do type > inference without strict typing (who asked " isn't the only way you can > begin to infer the type with real confidence is by having strict typed > parameters?") - but it's possible to do a great job at it, too. > > > 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. > > Those were our results: > PHPNG-JIT (JIT=on) 0.011 (25 times faster than php-7) > gcc -O2 (4.9.2) 0.013 > gcc -O0 (4.9.2) 0.022 > PHP-7 0.281 (15 times faster than php-5.0) > PHP-5.6 0.379 > PHP-5.5 0.383 > PHP-5.4 0.406 > PHP-5.3 0.855 > PHP-5.2 1.096 > PHP-5.1 1.217 > PHP-4.4 4.209 > PHP-5.0 4.434 > > Something broken in your setup. BTW, I'm not claiming our JIT is faster > than gcc. It's at the margin of error level. I think without actually making the code available, this specific point is just speculation, with all respects to the work having been done. If the goal is to have that in PHP, please publish now, not when you think it is what it should be. Doing so will allow other to test, provide feedback and maybe have ideas to solve one or another issue. --001a1134f158c0a6ca050fc7a52e--