Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:84179 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 58058 invoked from network); 2 Mar 2015 19:07:21 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 2 Mar 2015 19:07:21 -0000 Authentication-Results: pb1.pair.com header.from=julienpauli@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=julienpauli@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 74.125.82.46 as permitted sender) X-PHP-List-Original-Sender: julienpauli@gmail.com X-Host-Fingerprint: 74.125.82.46 mail-wg0-f46.google.com Received: from [74.125.82.46] ([74.125.82.46:44653] helo=mail-wg0-f46.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id D8/C6-14834-6E4B4F45 for ; Mon, 02 Mar 2015 14:07:19 -0500 Received: by wggx12 with SMTP id x12so35415970wgg.11 for ; Mon, 02 Mar 2015 11:07:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc:content-type; bh=QU4gRWwC3T2clMYKughSPKhGbcS9z9GDOOprzsuaboM=; b=ED16jZ/YMl60vMSeB0Mh1D6twDZ4O/pGxWj32j3NliRnQHPZPP+T9YUDjXq8IpFAce eBWXNfMrRsU28ikK8uNJXiWV/ttFm8W0c4Gmoqoga/FPyRA3XPNgC7RJALsBkcQY7+g1 RnuSgNKHwGJ2JNINJGhTWzYsJSr+C7o/yNdAfqme9ARtA+xrw2P6S4zrMfJlweZnxs0w Cl2+hQgAuciqfRwsL42x2+fzu5kFBbsQpGaVzggLl8zpO5zgIQrfQeBKHWT3VsddoCgZ hMTHaycWU4DA+hdBFVKiA9yIDRRALh8id2wIGAwmZ8/UuPVrtUOTKKxbeTErgIiMi+jT LYkQ== X-Received: by 10.180.149.206 with SMTP id uc14mr38521438wib.57.1425323236136; Mon, 02 Mar 2015 11:07:16 -0800 (PST) MIME-Version: 1.0 Sender: julienpauli@gmail.com Received: by 10.194.198.210 with HTTP; Mon, 2 Mar 2015 11:06:35 -0800 (PST) In-Reply-To: References: Date: Mon, 2 Mar 2015 20:06:35 +0100 X-Google-Sender-Auth: 4RWX4pAfi0g13N7Nfv9TL1B_M68 Message-ID: To: Dmitry Stogov Cc: Bob Weinand , Xinchen Hui , PHP Internals Content-Type: multipart/alternative; boundary=001a11c380082e1d54051052ed51 Subject: Re: [PHP-DEV] Re: About optimization for compiler From: jpauli@php.net (Julien Pauli) --001a11c380082e1d54051052ed51 Content-Type: text/plain; charset=UTF-8 On Fri, Feb 27, 2015 at 4:30 PM, Dmitry Stogov wrote: > On Fri, Feb 27, 2015 at 6:22 PM, Bob Weinand wrote: > > > > > > Am 27.02.2015 um 16:12 schrieb Xinchen Hui : > > > > > > On Fri, Feb 27, 2015 at 11:08 PM, Bob Weinand > > wrote: > > >> Am 27.02.2015 um 07:53 schrieb Xinchen Hui : > > >> > > >> Hey: > > >> > > >> On Fri, Feb 27, 2015 at 2:22 PM, Xinchen Hui > > wrote: > > >> > > >> Hey Internals: > > >> > > >> I was looking Bob's switch optimization.. > > >> > > >> And, I am not against this switch optimization.. > > >> > > >> I referring it to show where is my concerns came from > > >> > > >> thanks > > >> > > >> > > >> then I start to worry about where is the place optimization should > > >> goes.. > > >> > > >> in generally, PHP is a interpreted language. IMO, it should > > >> compiler the PHP codes to opcode without any optimization(of course, > > >> we did some, but they won't change a lots of opcodes which should be > > >> generated).. > > >> > > >> and, since 5.5, we already have opcache bundled in.. > > >> > > >> thus, I am proposing a principle, that is: > > >> > > >> in the future, we only do optimization in opcache side, and keep > > >> Zend Compiler without any optimization... considering Zend Compiler do > > >> things in -O0. > > >> > > >> since, optimization always are dangerous.. if we only do them in > > >> opcache, user can still run them codes with disable opcache, or at > > >> least disable some optimization level which cause that.. > > >> > > >> what do you think? > > >> > > >> thanks > > >> > > >> -- > > >> Xinchen Hui > > >> @Laruence > > >> http://www.laruence.com/ > > >> > > >> > > >> > > >> > > >> -- > > >> Xinchen Hui > > >> @Laruence > > >> http://www.laruence.com/ > > >> > > >> > > >> Hmm. I'm not sure, but do we really want to have the optimizations > > depending > > >> on opcache? > > >> > > >> I'd rather shift to slowly adding the optimizations into Zend/, in > > separate > > >> compiler steps you can (like in opcache too) enable and disable. > > >> It's actually a bit weird to have to include opcache just for its > > >> optimizations. Opcache should do what its name says: the sole task of > > > Actually, it was called ZendOptimizerPlus... > > > > I know, but still, it's better when an extension only does one thing and > > not two. > > > > >> caching the op_arrays. > > >> We need to change an extension for nearly every little change in > Zend/. > > That > > >> shouldn't be the case either. > > >> > > >> But just to say, it's not only a minor optimization, in a real world > > >> stateful parser it makes a difference of a few percent. > > >> And also, this optimization only adds a ZEND_SWITCH opcode, nothing > > more. > > >> (except in case we can determine at compile-time where the switch > land, > > then > > >> it will be optimized out to a simple JMP) > > >> > > > as I said, I am not against this change... I just want to setup a > > > rule, for where thoese optimization, which could also be done in > > > opcache. > > > > Doing it in opcache would currently need to play with extension-defined > > opcodes etc. I'd rather not be so invasive in opcache that after the > > optimizations it cannot run in a normal Zend VM anymore. (also a reason > why > > integrating into Zend would be a good idea) > > > > > or, maybe, we could embed opcache(Optimizer) into Zend later... but of > > > course, it only can happen in next major version... > > > > Do we really need a major version for this? It doesn't involve major > > ABI/API breaks. The compiler step is usually also rather left untouched > by > > most extensions. If we want to do this, we could target 7.1 without major > > issues. > > > > I think so. This may affect some binary interface but should be completely > transparent for users. > > Thanks. Dmitry. > > > > > > > > > > > > thanks > > >> Bob > > > > > > > > > > > > -- > > > Xinchen Hui > > > @Laruence > > > http://www.laruence.com/ > > > > Bob > > > > > Bob's code optimizes things by adding a new OPCode. This is different from compiler optimizations. Compiler optimizations are about changing native, supported OPCode structures to other native supported OPCode structure, but that will run faster at runtime. I agree with dmitry that if we separate the optimizer from the OPCode cache (both in OPCache actually), then the one who will use the optimizer but not the cache, will suffer from a drop in performance. This is silly and should be prevented. We should keep both the optimizer and the cache together IMO, or, we should forbid the optimizer to fire up if no OPCode cache is done after (as the optimizer will eat some performances for nothing). We discussed some time ago to merge OPCache into PHPCore (back to PHP 5.5 dev) I'm all +1 with that, and for doing that for PHP7.0 When PHP 7.0 will be released, we will not support any new feature in OPCache for PHP5 branches anyway. As OPCache is nowadays not compatible at all with PHP7 (development has not started yet, or I'm not aware of it) , why not merge OPCache to PHP7 source tree (when the time for this will come), still as an extension at first time, and keep developing optimizer passes into this (aka : not in Zend/) ? I'm also +1 to keep our optimizations into OPCache (into an extension), and allow them to be disabled (like its the case actually), because this subject is very hot and sensible. We should keep a PHP compiler as-is, and move optimization passes away from it. zend_extension_op_array_handler() callback is designed for that purpose. Julien.Pauli --001a11c380082e1d54051052ed51--