Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:83553 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 13656 invoked from network); 23 Feb 2015 09:05:53 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 23 Feb 2015 09:05:53 -0000 Authentication-Results: pb1.pair.com header.from=zeev@zend.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=zeev@zend.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain zend.com designates 209.85.223.171 as permitted sender) X-PHP-List-Original-Sender: zeev@zend.com X-Host-Fingerprint: 209.85.223.171 mail-ie0-f171.google.com Received: from [209.85.223.171] ([209.85.223.171:43375] helo=mail-ie0-f171.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id D7/F8-01128-F6DEAE45 for ; Mon, 23 Feb 2015 04:05:52 -0500 Received: by iebtr6 with SMTP id tr6so21616280ieb.10 for ; Mon, 23 Feb 2015 01:05:48 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:references:in-reply-to:mime-version :thread-index:date:message-id:subject:to:cc:content-type; bh=Ltemxe7QP4Xm0BB9fMJ3fwApA9buTVvpbwe8LH9LpLQ=; b=eUA6QmXvCeH3b9j4VzeV4zLoMjnnz3q9FXw3tfxWjyeLDVkctZroVcxqPilbYcn7bC Rbrh8hAX6ikdZTpSebsh0K3Y+RJOjsYdPCj1Jv4CSalux3tT1oufq3UdPe+0VodgGuZi lHhgC4iiS3XcuEimuZVayvx6rG0Sn/NKPXL9pttmzz8STsLs/K76ThHCjN7RB5JiHC4E A32vyfwWipTNYD7PPX+3b5oKmORzzzNlOnZubuzz7ujnXLpSQs1QaVWjhq0BjEqsUPX0 QDCt35H7+mmEJ38y51m59V7FKk3cMVHOG111QDSEAoCdtN1ZK1HaF4NgduxoYA4LlCgN G2ZQ== X-Gm-Message-State: ALoCoQk9LExeb404lVIKEUIeIvcrAIPXItkrpxAdaICmYCY+0xLt9IAvmWRqcrU6S3CWMSqKdsIKMDoZ/nVqF23289bDcfIlVlD6E72pzk6g1B0Y6iFHvDlC3AaiB1At3vQwy1dMxnN1cIw417cY3YH3QhWmJ42bUg== X-Received: by 10.43.103.8 with SMTP id dg8mr10376410icc.18.1424682348698; Mon, 23 Feb 2015 01:05:48 -0800 (PST) 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> In-Reply-To: MIME-Version: 1.0 X-Mailer: Microsoft Outlook 14.0 Thread-Index: AQIDXD7ehmaYKzbAddTs7O1sB4MzmgIw+OLdAe4e2iYCibfnDQEmdWqtAiDZcfAB4cR2SQJXxpD6Ais01rQBOuFyBwIXH55km/qaqHA= Date: Mon, 23 Feb 2015 11:05:48 +0200 Message-ID: <661590f4daa710176268b43c1b950583@mail.gmail.com> To: Joe Watkins Cc: PHP internals Content-Type: text/plain; charset=UTF-8 Subject: RE: [PHP-DEV] JIT (was RE: [PHP-DEV] Coercive Scalar Type Hints RFC) From: zeev@zend.com (Zeev Suraski) > -----Original Message----- > From: Joe Watkins [mailto:pthreads@pthreads.org] > Sent: Monday, February 23, 2015 10:03 AM > To: Jefferson Gonzalez > Cc: Zeev Suraski; PHP internals > Subject: Re: [PHP-DEV] JIT (was RE: [PHP-DEV] Coercive Scalar Type Hints > RFC) > > Zeev, > > I missed the initial replies to this, just had a quick read through > (of the kind > you have first thing on a Monday morning). > > Essentially the problem is this: > > > My point is that we can do the very same optimizations with coercive > types as well - basically, that there is no delta. > > The problem is that an implementation that has to care about coercion, > one that has to care about nonsense input, has to generate considerably > more complex code, to manage that input or perform those coercions. Not necessarily. If you can infer the type with confidence, you can do away with coercion code altogether. If you can't, then you're not obligated to generate optimized paths for every possible input - you can just defer to the relevant coerce() function. It's very similar to what you'd be able to do with strict, except instead of calling coerce(), it would run a runtime type check that errors out on failure. The difference is that of functionality, not performance. > You may be able to perform some of the same optimizations, but the code > executed at runtime is going to be more complex to execute and to > generate, that is obviously true. Again, not necessarily. We shouldn't assume we'll generate machine code for all the possible flows. The code generated would be very similar in both strict and coercive cases. > The JIT Zend had needed to generate similarly complicated code and *it > was not faster than PHP, in the real world*, we are told. It depends on what kind of real world we're talking about here. For number crunching, it's super-fast with very tangible gains, and that's an understatement. Not sure if you saw my email from yesterday, but it shows 25x (2500%, no mistake) gains on bench.php, with zero changes to the code, and obviously, without type hints, strict or dynamic. With web apps we tested, there wasn't a tangible difference, but that doesn't (yet) mean much. We stopped most of the work on it when the PHPNG effort began. It may or may not be possible to squeeze more performance using JIT out of these apps, we won't know until we try again. > I'm not sure what you are arguing about, there is no point in > generating any > code that is not faster than Zend, and Zend just got a bunch faster. JIT might end up being about making PHP viable for more CPU-bound use cases, rather than speeding up existing Web workloads. But it's way too early to conclude that. Thanks, Zeev