Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:84016 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 88307 invoked from network); 27 Feb 2015 15:27:01 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 27 Feb 2015 15:27:01 -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.181 as permitted sender) X-PHP-List-Original-Sender: dmitry@zend.com X-Host-Fingerprint: 209.85.220.181 mail-vc0-f181.google.com Received: from [209.85.220.181] ([209.85.220.181:41840] helo=mail-vc0-f181.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id AC/A5-32582-4CC80F45 for ; Fri, 27 Feb 2015 10:27:01 -0500 Received: by mail-vc0-f181.google.com with SMTP id im6so6570521vcb.12 for ; Fri, 27 Feb 2015 07:26:58 -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=jq1JVczqfeG+ipcncDW1BvVeSW9aN7NHkT9nF3Lb1N4=; b=kxrKriHmB7ePbRYQjPFXp+gYlSXZJsuu0XjPWgt0DGOpr4WM7S2yO2Oee51gHalyol 39ZSX6CqU5PoejNpWXvhQlZhBvbpP8MBaIvnhQy7SZrLdnHGEvDJGpHarWUjNhCfxdBG Gjszss0ohT2jo5tUlfWLqNBCBw4wXzvXw1G1vwokD9KZ7jDac50SvHnO7JgfNf7zxUZ+ WwohyYMGxkZmY924nYumJUUOU+H5BmdBPzNbYB/fg3tQwAtFcb+hfZ25h/+X8WIadUNo 0M6m5rmyCyYJnDmVmANIViRxoX3yLoxw7vTjaknhRnYAxis/YfRZkCspouwGYjeNSX7w XMwQ== X-Gm-Message-State: ALoCoQlqF+TXZq5LyYVz0epZP5ajQU2EIO0zuatH7O4p9Lpe96lKAw5zAbJbyQtKxOkFUnEGn+U//xSBGyqgIjOjzyMoQ9Gw2MRDYXORiZb+sFXuEzT4A/ol4OUYxiMa70Ru5/HU0F1wB5KqYz/fBFRCM+j6Ha05Gg== MIME-Version: 1.0 X-Received: by 10.52.134.141 with SMTP id pk13mr4579820vdb.5.1425050818191; Fri, 27 Feb 2015 07:26:58 -0800 (PST) Received: by 10.52.113.231 with HTTP; Fri, 27 Feb 2015 07:26:58 -0800 (PST) In-Reply-To: References: Date: Fri, 27 Feb 2015 19:26:58 +0400 Message-ID: To: Bob Weinand Cc: Xinchen Hui , PHP Internals Content-Type: multipart/alternative; boundary=bcaec52bf2d9ce39570510137f1b Subject: Re: About optimization for compiler From: dmitry@zend.com (Dmitry Stogov) --bcaec52bf2d9ce39570510137f1b Content-Type: text/plain; charset=UTF-8 On Fri, Feb 27, 2015 at 6: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? > The big practical problem. That without opcache optimizations are executed on each request. This means that they may require more time to work, than the gain from bytecode improvement. > 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 > caching the op_arrays. > We need to change an extension for nearly every little change in Zend/. > That shouldn't be the case either. > Yes. Opcache is extremely depends on engine. Moving optimizer from opcache to ZE may be a good idea. Technically it's possible, but I'm not sure when and how it should be done. I think optimizer need to be refactored as well, but this is only for 7.1 probably. > 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) > Your ZEND_SWITCH optimization makes sense. Unfortunately, implementation is a bit messy (not intuitive). The biggest problem that it doesn't fit with existing Optimizer. For now I don't know how to change Control Flow Graph representation and corresponding pass to support ZEND_SWITCH. Thanks. Dmitry. > > Bob > --bcaec52bf2d9ce39570510137f1b--