Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:84252 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 60897 invoked from network); 3 Mar 2015 17:16:03 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 3 Mar 2015 17:16:03 -0000 Authentication-Results: pb1.pair.com smtp.mail=dmitry@zend.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=dmitry@zend.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain zend.com designates 209.85.220.170 as permitted sender) X-PHP-List-Original-Sender: dmitry@zend.com X-Host-Fingerprint: 209.85.220.170 mail-vc0-f170.google.com Received: from [209.85.220.170] ([209.85.220.170:35106] helo=mail-vc0-f170.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id E0/21-03783-25CE5F45 for ; Tue, 03 Mar 2015 12:16:03 -0500 Received: by mail-vc0-f170.google.com with SMTP id hq12so13930907vcb.1 for ; Tue, 03 Mar 2015 09:15:59 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type; bh=xicewYYn0KAhP/PcwJz2hwPa4KAyJqkFadQ1R1jLBcM=; b=d0rMUUaRIyw2ESJ3OOlsxLkNJxJ+rFyKNsEBJOQ8t/kzHvDMnoKLzRX/0CCgtEZ+M+ oplPm5EY0wQPS91f4dGZ/Q8k9UdKrWsIDchWbQnWGVNI50juX2wsKxiu+ZXvyVSGy4+/ HD7WgQgYAyQZvalNU0Xopq3WjjyNc+1aTECW+yw0aauvOgIjTmyd6mJ2jKusp9dfwbeH p567cihWrHpl11eCl7D1heSEnodQ6L1tr/RQ8pIfBjhe66l9vaVu4DltfkvVnsBRZDvM 2X/tclK0icKdyiKfhm4cSKzNHCdOE+Y6Ly0WZWr+F7ryxUlZdbYM5nPeYG3XmRgmsWbE s54A== X-Gm-Message-State: ALoCoQk+vjedS4YWa+eSi0YHmkYzw0BhT1ek6yBX4whsdIxO708LdzB7pyfCIErWqP3oThp3HJ6ed6EHZSEsr+bd4uZlvivLSdwYbZSzbJOfRXeiCQtwJghuzCr328L33lToObdQ3hz9quumRKfyN+wyR3j6UWgLbA== MIME-Version: 1.0 X-Received: by 10.52.51.198 with SMTP id m6mr30464454vdo.38.1425402959217; Tue, 03 Mar 2015 09:15:59 -0800 (PST) Received: by 10.52.113.231 with HTTP; Tue, 3 Mar 2015 09:15:58 -0800 (PST) In-Reply-To: References: <54F08FF3.3040404@seld.be> <63262a9c0edd51bbf38df2a00c87340e@mail.gmail.com> <9977a20c9d756489f41e666d23c89e3f@mail.gmail.com> <9656140ae786d42e7b0da11dbd416a61@mail.gmail.com> Date: Tue, 3 Mar 2015 21:15:58 +0400 Message-ID: To: Anthony Ferrara Cc: Zeev Suraski , PHP Internals Content-Type: multipart/alternative; boundary=001a1136a0ea0be1e50510657dd7 Subject: Re: [PHP-DEV] Re: Zend JIT Open Sourced From: dmitry@zend.com (Dmitry Stogov) --001a1136a0ea0be1e50510657dd7 Content-Type: text/plain; charset=UTF-8 On Tue, Mar 3, 2015 at 6:44 PM, Anthony Ferrara wrote: > Zeev, > > On Tue, Mar 3, 2015 at 8:05 AM, Zeev Suraski wrote: > >> So I do apologize to the person. I don't to the code. > > > > I wanted to verify whether my gut was correct (minimal amount of output, > and > > stdout is in fact buffered - output shouldn't move the needle) and asked > > Dmitry to rerun the C test on the same system, but this time with the > output > > code completely commented out: > > real 0m0.011s (+- 0.01) > > user 0m0.011s (+- 0.01) > > sys 0m0.001s > > > > Apologies to the code might be in order :) > > > > The source of the JIT engine's edge is, as Dmitry and Andi said, the > > CPU-specific optimizations that gcc -O2 doesn't generate, and therefore > it > > can actually be faster than a generic native executable in some (I would > > guess not all that common) cases. > > So, let's put that to the test, shall we. I compiled and ran the "JIT" > compiler (can we please stop calling it that, it's not). This is JIT! > along side > PHP 5.5, PHP 7 and GCC -O0 through -O3. > > I also turned on the ob_start and off (commenting out the ob_start and > ob_end_flush lines): > ope > > https://docs.google.com/spreadsheets/d/1b4yFh0i62haDoQBRf8pOoi63OLrxRbecHSj9sQpD5Nk/edit?usp=sharing > > With ob_start, the "JIT" was fastest. Without it, it was more than 2x > slower (slightly faster than -O0). > C FILE API is buffering as well. I hope you knew. Use write() instead of printf() in C to disable buffering as well. Raw results (average): > > GCC -O0: 0.0258 > GCC -O1: 0.0160 > GCC -O2: 0.0144 > GCC -O3: 0.0140 > "JIT" /w ob_start: 0.011 > "JIT" /wo ob_start: 0.0238 > 5.5 /w: 1.273 > 5.5 /wo: 1.301 > 7 /w: 1.492 > 7 /wo: 1.545 > > I used identical code to what Dmitry posted earlier, with the one > exception that ob_start was commented out for the "/wo" runs. > Now, there's something really interesting in those results. The > numbers given back from the "JIT" are far more stable than anything > else (more than an order of magnitude more stable /wo, and several > orders /w ob_start). Something smells off about it. I'm not so sure > what off hand, but I'm going to dig further. > php -d opcache.jit_debug=0x100 bench.php > > Now, to the point that "gcc uses output buffering". Yes, it does. > However, PHP (including the "JIT") is compiled with GCC. So it will > use a similar output buffer unless you disable the buffer. The only > place in 7 that we do that is sapi/phpdbg/phpdbg.c:881. So either way, > you're going to be using the same output buffer on the STDOUT stream. > Please check php/sapi_cli.c and the setting of PHP_WRITE_STDOUT before claiming others. Thanks. Dmitry. > > Anthony > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > > --001a1136a0ea0be1e50510657dd7--