Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:84011 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 79407 invoked from network); 27 Feb 2015 15:12:52 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 27 Feb 2015 15:12:52 -0000 Authentication-Results: pb1.pair.com smtp.mail=laruence@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=laruence@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.215.48 as permitted sender) X-PHP-List-Original-Sender: laruence@gmail.com X-Host-Fingerprint: 209.85.215.48 mail-la0-f48.google.com Received: from [209.85.215.48] ([209.85.215.48:33009] helo=mail-la0-f48.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id EB/A3-32582-37980F45 for ; Fri, 27 Feb 2015 10:12:52 -0500 Received: by labgf13 with SMTP id gf13so18169005lab.0 for ; Fri, 27 Feb 2015 07:12:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type; bh=2gRsHL3PLos0hZhc5kDZ1LjWbphx8BDwu+cRQNC47GQ=; b=GBgLoLEwc3qwrcDyZgi7ZepDP29yO5m+R644iKa6KxK+2NNQhILs4ZKFK1QpIwLid8 02MTo6xW3GEC3F+6q/J9OiDuBsHS7WvVKkikX0Dorn99edHcX7ZUPUTocGFqvPME7I3F 8oNvxGSNnCEtKuWS22Ap/HiOzcxY2FPuTZxPgewc3otpPPhxFo8ZdLV2TNTdaTVpoQ/I fTwDY37vvD/3bczqGhwu8sTanIkQA6GhTHjIvUefNaynjpF8DU/rbq6iUC4YLAnASb3w injt3nTfTnYyNcZjcPTyr0xjU3Ytgwe8izlimPowLiA+z37y6c6Iod56fIZSoVmHn+p9 399w== X-Received: by 10.112.188.227 with SMTP id gd3mr12838642lbc.22.1425049968217; Fri, 27 Feb 2015 07:12:48 -0800 (PST) MIME-Version: 1.0 Received: by 10.114.28.198 with HTTP; Fri, 27 Feb 2015 07:12:27 -0800 (PST) In-Reply-To: References: Date: Fri, 27 Feb 2015 23:12:27 +0800 Message-ID: To: Bob Weinand Cc: PHP Internals , Dmitry Stogov Content-Type: text/plain; charset=UTF-8 Subject: Re: About optimization for compiler From: laruence@gmail.com (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... > 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. or, maybe, we could embed opcache(Optimizer) into Zend later... but of course, it only can happen in next major version... thanks > Bob -- Xinchen Hui @Laruence http://www.laruence.com/