Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:84018 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 91563 invoked from network); 27 Feb 2015 15:31:01 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 27 Feb 2015 15:31:01 -0000 Authentication-Results: pb1.pair.com header.from=dmitry@zend.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=dmitry@zend.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain zend.com designates 209.85.220.179 as permitted sender) X-PHP-List-Original-Sender: dmitry@zend.com X-Host-Fingerprint: 209.85.220.179 mail-vc0-f179.google.com Received: from [209.85.220.179] ([209.85.220.179:55387] helo=mail-vc0-f179.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 13/66-32582-0BD80F45 for ; Fri, 27 Feb 2015 10:30:59 -0500 Received: by mail-vc0-f179.google.com with SMTP id hy4so6593342vcb.10 for ; Fri, 27 Feb 2015 07:30: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:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type; bh=3VU5rmCwb0yrIKCCZNOKA/1DPQh2+BT5KBeMA/QQCOg=; b=Ydhk7qmaEKSdc6wuCAG1jREfNfu8nFcB2DpGVpzwNA/5px9lTxgazN602vqhtAtCNF MwA3Uf1QvUy/c+J0sLCTpbNY4xWkwN4b4/B+ku9XuqnqoZ5maid+XLk3UfqO5EUYytdA tm7Lorvo7I9eNwDQxzQpB2zZnWWJ0nJ0VNya+KUcW09eU/cFYttN2Pi7MFv+Bi7ACtpn en8J5di35OQ66LYBQ0aMzmn9HXVVdc+o+1Ad0iqRU2y9WDM0V5GOlwSkHQWsESrheSja VIRPnuCSFWTmT5ot2F9qwNX+A8jSAzcYmD0QMgJsHa93v/NAd+hYIzPgv/I71My+aMaw ySug== X-Gm-Message-State: ALoCoQk1cDi31qnIdFw2OdERFhtxDrHf9PQSfzEyYqzr269T7lvjAcQZ5AlQV1wdxgNCj++6G5poGtdFDDXBOSTFDYwAmfYV+ZIDemFaqCMKZ5PIGffZbzou9CYQ70Zch6uMhvItKhz8m4HpEd1r3Ky2Qx7lRMLxpA== MIME-Version: 1.0 X-Received: by 10.52.25.11 with SMTP id y11mr13349982vdf.51.1425051048486; Fri, 27 Feb 2015 07:30:48 -0800 (PST) Received: by 10.52.113.231 with HTTP; Fri, 27 Feb 2015 07:30:48 -0800 (PST) In-Reply-To: References: Date: Fri, 27 Feb 2015 19:30:48 +0400 Message-ID: To: Bob Weinand Cc: Xinchen Hui , PHP Internals Content-Type: multipart/alternative; boundary=001a1133e5f28843a50510138ddd Subject: Re: [PHP-DEV] Re: About optimization for compiler From: dmitry@zend.com (Dmitry Stogov) --001a1133e5f28843a50510138ddd Content-Type: text/plain; charset=UTF-8 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 > > --001a1133e5f28843a50510138ddd--