Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:90213 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 69667 invoked from network); 6 Jan 2016 19:01:43 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 6 Jan 2016 19:01:43 -0000 Authentication-Results: pb1.pair.com smtp.mail=php@golemon.com; spf=softfail; sender-id=softfail Authentication-Results: pb1.pair.com header.from=php@golemon.com; sender-id=softfail Received-SPF: softfail (pb1.pair.com: domain golemon.com does not designate 209.85.215.48 as permitted sender) X-PHP-List-Original-Sender: php@golemon.com X-Host-Fingerprint: 209.85.215.48 mail-lf0-f48.google.com Received: from [209.85.215.48] ([209.85.215.48:34676] helo=mail-lf0-f48.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 5E/C7-21755-6946D865 for ; Wed, 06 Jan 2016 14:01:43 -0500 Received: by mail-lf0-f48.google.com with SMTP id y184so318567090lfc.1 for ; Wed, 06 Jan 2016 11:01:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=golemon-com.20150623.gappssmtp.com; s=20150623; h=mime-version:sender:in-reply-to:references:date:message-id:subject :from:to:cc:content-type; bh=QyIFP2sKDvRArmmJeNg8dVFaQxiFgINgmYL1n6njv8k=; b=BAdEoeCQvCFhu3grcDcND7hiNbgY+xGWwHA2RDuf3JRQaJoG+Qdkduw/qaF/UVxHBV 3ogtfCQD1Mdti0O3Fp1XXlVYXfkuYttrczeeoxuGTItvjhx7Uhj4tZ8IUA6LvwXAubxp imnx5Pi4JPr37AEvgYMdKEhgUUxxYPSIm/LvjxXb7i1wHeZCVKA8N3M7YTxirUzEMIfV pIrFMrgQFqmMVH3wuiGIAbxFpgOuhRPy8pmhEJV/7V6rKHf0tmbS2Uqji5bOqYlyMahC W0JJ24EYXeiLzgOkvs22pwWnhplmto5mNGQ5nXM3zYfzTG9WRWYUFCEIMg0ETgoUlk7w d0fQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:sender:in-reply-to:references:date :message-id:subject:from:to:cc:content-type; bh=QyIFP2sKDvRArmmJeNg8dVFaQxiFgINgmYL1n6njv8k=; b=anGSB+z/dZ/KMPw9vRMVtYVQfPE+LUvddPoBNX0zakCrsKDqN8JVN/gGCqa6aIneOy ymutYqrsEVjKWfKGax+R/Y/DAcMkLKyJZQEUh5RzkDQ2gD5omXnWOhJLEJHhd09kXXrX QF5H7xVo56mkDltBsgnQ2VMqKFyssXwQqL6y8j+uTfvTSlRr+OAZNjibvkC3cdaqObz+ Ng8Yhrcoh66nJEXl71jqMcJWIBASACDIhuQ9h3R99F+OcXsl4H8hhewKguRl06bIXbPG VAqTTHe8jGEsyicNG0zELVsVGUL1QNKuFmVTfTf2HLEcJHj7qNn4OZIp5uNafeio69Bz y1+A== X-Gm-Message-State: ALoCoQlkVhulKN/6IwaV6rXJLaGS0oM7YdwiBSARYsy5WPNBusJOERRsjCZe6Cz6E/fGnAL17ayjq7LncgSIRy01a6k0X7kTcw== MIME-Version: 1.0 X-Received: by 10.25.17.89 with SMTP id g86mr11724989lfi.82.1452106899925; Wed, 06 Jan 2016 11:01:39 -0800 (PST) Sender: php@golemon.com Received: by 10.112.37.44 with HTTP; Wed, 6 Jan 2016 11:01:39 -0800 (PST) X-Originating-IP: [199.201.64.2] In-Reply-To: References: Date: Wed, 6 Jan 2016 11:01:39 -0800 X-Google-Sender-Auth: HIwShvMdAdM5zSKH1xd1oQf7iLw Message-ID: To: Nikita Popov Cc: PHP internals Content-Type: text/plain; charset=UTF-8 Subject: Re: [PHP-DEV] [RFC] Normalize token_get_all() output (with flag) From: pollita@php.net (Sara Golemon) On Wed, Jan 6, 2016 at 1:43 AM, Nikita Popov wrote: > Basically: token_get_all() is rather slow. I think it says something that > getting the tokens of a script is about as slow as lexing it, parsing it > into an internal AST and constructing an object-based userland AST for it. > If you use token_get_all() in a matter that only requires one lookahead > token at a time, you don't really care about how nice the token format is, > you're only interested in it being efficient. I was hoping that we can > optimize it by dropping the line numbers (which is the most volatile part of > the structure) and try to reuse the same array for tokens which have the > same ID and content (but likely different lineno). It's very likely that a > script contains the T_WHITESPACE( ) token more than one and similarly labels > and variables tend to repeat, etc. No idea if that would actually work/help, > just an idea. > Ah, I see what you mean. That'll take some thinking, and is well outside the scope of this RFC, but I'll give it some thought and maybe you or I or someone can gist something up later maybe... -Sara