Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:62848 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 88565 invoked from network); 6 Sep 2012 08:01:58 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 6 Sep 2012 08:01:58 -0000 Authentication-Results: pb1.pair.com smtp.mail=leight@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=leight@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.220.170 as permitted sender) X-PHP-List-Original-Sender: leight@gmail.com X-Host-Fingerprint: 209.85.220.170 mail-vc0-f170.google.com Received: from [209.85.220.170] ([209.85.220.170:63920] helo=mail-vc0-f170.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 1C/D4-01139-57858405 for ; Thu, 06 Sep 2012 04:01:58 -0400 Received: by vchn11 with SMTP id n11so2171810vch.29 for ; Thu, 06 Sep 2012 01:01:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=S1QYA1aseZ7ZmPVLLdUXrEeKj2WghhhlALD2C27c5u8=; b=IQ++IiBMCL4gELHbn/VDdmMys4P731dX6W7dtKRXHOXVR4aXGAla6af+4lHec1Xiaz slBRWskq79J0WeNAeDYN6WKbyQuq8vCEEFgBqoZX6X/4XKfMc79UgwRY6RNZJB4NUYVu UfgQfh/90l4UNUFpJ6dcNqLKB+EgD+sixxj8kCONSm8N8qqgTCbP/XgOrVXyYDXo0uEn aB7SzrvGsLFg6vGxqKctVU2gXvI5/lpbNISOrIo7Cogwm5rKCV+wE6pQ7nxYFZomfj9I BUeAmQr53etik2fhIGFHiSELdBfmUSD3rychBctYw1eEGkV0HZFFSESsMUfhHwtaJxBK 5jLQ== MIME-Version: 1.0 Received: by 10.52.98.67 with SMTP id eg3mr928722vdb.5.1346918514868; Thu, 06 Sep 2012 01:01:54 -0700 (PDT) Received: by 10.58.76.105 with HTTP; Thu, 6 Sep 2012 01:01:54 -0700 (PDT) Received: by 10.58.76.105 with HTTP; Thu, 6 Sep 2012 01:01:54 -0700 (PDT) In-Reply-To: <50485647.1060102@hoa-project.net> References: <504836A3.20904@zend.com> <50485647.1060102@hoa-project.net> Date: Thu, 6 Sep 2012 09:01:54 +0100 Message-ID: To: ivan.enderlin@hoa-project.net Cc: internals@lists.php.net Content-Type: multipart/alternative; boundary=20cf307d04d29ec35204c903e7a1 Subject: Re: [PHP-DEV] Moving to an AST-based parsing/compilation process From: leight@gmail.com (Leigh) --20cf307d04d29ec35204c903e7a1 Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: quoted-printable Hi > The lexing and parsing processes will not be slower than actual, and the construction of an AST is a new process. Well, as usual, new process requires new resources. But if we look further, it will certainly be a nice tool to perform better opcode caching, it will remove a lot of hacks, it will allow third-part tools working on safeness, security, quality etc. to go deeper at low-costs which is very important for PHP community, it will facilitate future works I think this is a good point to focus on, there has been a lot of comments about the increased resource cost of the parse. What is being forgotten is that you can offset this against all of the gains you will see as a result. Maybe the upfront cost of a parse goes up, but once it is parsed and the opcodes are cached, you won't have this cost again until you change the script. Then you have all of the benefits for every subsequent request. Increased cost once, benefits every time. On Sep 6, 2012 8:53 AM, "Ivan Enderlin @ Hoa" wrote: > Hi Dmitry, > > On 06/09/12 07:37, Dmitry Stogov wrote: > >> Hi Nikita, >> >> Personally, I don't see any reason to build AST. As you mentioned >> yourself, it will be slower and will require more memory. On the other h= and >> AST itself would allow to perform only very basic optimizations. Most of >> them can be easily done on VM opcode level as well. >> > The lexing and parsing processes will not be slower than actual, and the > construction of an AST is a new process. Well, as usual, new process > requires new resources. But if we look further, it will certainly be a ni= ce > tool to perform better opcode caching, it will remove a lot of hacks, it > will allow third-part tools working on safeness, security, quality etc. t= o > go deeper at low-costs which is very important for PHP community, it will > facilitate future works (implementations, features etc.) for PHP=85 Moreo= ver, > it may be possible that compiler compilers have a better lexing and parsi= ng > processes than actual? > > Someone said that AST is more =93academical=94, yes it is and that is why= we > can benefit from already done researches in this area to avoid memory > overhead (one among others). We are not the first ones facing this proble= m. > It requires some researches before starting to develop this. Let's try as= a > POC and we will quickly see if this is a wrong way or not. > > Cheers. > > > >> Also, as it's not an easy task, the old "ugly hacks" will be replaced >> with new mistakes, which would require new "hacks" in the future :) >> >> The only real advantage could be an ability to expose AST to PHP scripts= , >> but only few people may need it. >> >> Thanks. Dmitry. >> >> On 09/04/2012 11:57 PM, Nikita Popov wrote: >> >>> Hey folks! >>> >>> Some people asked me what the advantages of using an AST-based >>> parsing/compilation process are, so I put together a few quick notes >>> in an RFC: >>> >>> https://wiki.php.net/rfc/ast_**based_parsing_compilation_**process >>> >>> It would be nice to get a few comments from other core devs on this. >>> >>> Nikita >>> >>> >> >> > -- > Ivan Enderlin > Developer of Hoa > http://hoa.42/ or http://hoa-project.net/ > > PhD. student at DISC/Femto-ST (Vesontio) and INRIA (Cassis) > http://disc.univ-fcomte.fr/ and http://www.inria.fr/ > > Member of HTML and WebApps Working Group of W3C > http://w3.org/ > > > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > > --20cf307d04d29ec35204c903e7a1--