From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: [Emacs-diffs] master 05dc679: Turn on lexical-binding in json.el Date: Thu, 11 Aug 2016 16:35:45 -0400 Message-ID: References: <20160810044910.10174.12870@vcs.savannah.gnu.org> <20160810044911.2B1C52201C2@vcs.savannah.gnu.org> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1470947643 8350 195.159.176.226 (11 Aug 2016 20:34:03 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Thu, 11 Aug 2016 20:34:03 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1.50 (gnu/linux) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Aug 11 22:33:59 2016 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bXwfv-00023H-3a for ged-emacs-devel@m.gmane.org; Thu, 11 Aug 2016 22:33:59 +0200 Original-Received: from localhost ([::1]:50448 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bXwfs-0000j4-5R for ged-emacs-devel@m.gmane.org; Thu, 11 Aug 2016 16:33:56 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:40222) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bXwfG-0000Wa-OZ for emacs-devel@gnu.org; Thu, 11 Aug 2016 16:33:19 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bXwfC-0001eK-D1 for emacs-devel@gnu.org; Thu, 11 Aug 2016 16:33:17 -0400 Original-Received: from [195.159.176.226] (port=60657 helo=blaine.gmane.org) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bXwfC-0001bz-6L for emacs-devel@gnu.org; Thu, 11 Aug 2016 16:33:14 -0400 Original-Received: from list by blaine.gmane.org with local (Exim 4.84_2) (envelope-from ) id 1bXwf5-0000kk-B6 for emacs-devel@gnu.org; Thu, 11 Aug 2016 22:33:07 +0200 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 19 Original-X-Complaints-To: usenet@blaine.gmane.org Cancel-Lock: sha1:ztezIcwATigca1OkXpqDzBK8Rb8= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 195.159.176.226 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:206572 Archived-At: > in order to support dynamic binding. With lexical scoping enabled, and in the > absence of closures, it should be possible to fully localize such references > so that no lookup is performed at all. Lexical variables aren't stored in symbols's slots, but in the byte-code stack. So a variable access is an access to the (byte-code) stack with a fixed offset. Not sure how much faster that makes it, tho. > I'm not sure whether the byte-compiler makes use of such an > optimization, or if we even have a byte-code operand to support it, > but my unsupported guestimate is that we could double performance in > most areas by properly utilizing lexical binding. Especially in tight > loops that update/modify a local variable. Lexical scoping does open up a fair bit of room for optimization, indeed, and we haven't really tried to take advantage of it yet. Stefan