From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: John Wiegley Newsgroups: gmane.emacs.devel Subject: Re: [Emacs-diffs] master 05dc679: Turn on lexical-binding in json.el Date: Thu, 11 Aug 2016 10:34:01 -0700 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 1470936988 6527 195.159.176.226 (11 Aug 2016 17:36:28 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Thu, 11 Aug 2016 17:36:28 +0000 (UTC) User-Agent: Gnus/5.130014 (Ma Gnus v0.14) Emacs/25.0.95 (darwin) Cc: Mark Oteiza , emacs-devel@gnu.org To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Aug 11 19:36:24 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 1bXtu2-0001VN-2p for ged-emacs-devel@m.gmane.org; Thu, 11 Aug 2016 19:36:22 +0200 Original-Received: from localhost ([::1]:49932 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bXtty-0007NO-KK for ged-emacs-devel@m.gmane.org; Thu, 11 Aug 2016 13:36:18 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:60106) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bXtsp-0007Lg-JI for emacs-devel@gnu.org; Thu, 11 Aug 2016 13:35:08 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bXtsm-00044Y-Ff for emacs-devel@gnu.org; Thu, 11 Aug 2016 13:35:07 -0400 Original-Received: from mail-pa0-x244.google.com ([2607:f8b0:400e:c03::244]:34095) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bXtsm-000445-7h for emacs-devel@gnu.org; Thu, 11 Aug 2016 13:35:04 -0400 Original-Received: by mail-pa0-x244.google.com with SMTP id hh10so102254pac.1 for ; Thu, 11 Aug 2016 10:35:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:in-reply-to:date:message-id:references :user-agent:mail-followup-to:mime-version; bh=jnvBRkrSVTDzzPD+MpmcDfUmlzJ+EXbhEg5g0kMN150=; b=znTzPmFQe2pPzgWjRmIuS8zTVRmbkcs4XR8McDXU+IXUwaLPsNApbmtfE14RT+OsIW fKWQMUtL8nU/+nwFmQSbzfiCUNbj91d5p8O6F0SYKN4B23m2VwgZOzBxWX4M61LqYWG6 lGBuMW3yQXq+tTP8vy5R10pbYR/Hir77NYX5SfervUg8R0KOhILVfeJiHD11aWtFXUdC +wEUz68sSNsruJMQFCFrxs8v3t4ZRdDw8Flc8R9NYmc+6/eijRuHKoCAtbybmx5UkJHf vm3ziD++KJjFSNNgos44M1dVZWIQSdoFfCSUAAPXeoBfPpXoaUdOqbLkKPbOs2KBJtq6 gllw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:in-reply-to:date:message-id :references:user-agent:mail-followup-to:mime-version; bh=jnvBRkrSVTDzzPD+MpmcDfUmlzJ+EXbhEg5g0kMN150=; b=CtJPxjaCA4MhZdmNOEi2WoXNSK5QgOZ7epGBrXvK3lwMq3lIGXFYZsvOnF3lfMAk09 +6YgbJwbx6yc7j5DbGkJiRNhgr6oXaHAY/VKaFDWBUEkFGJ6BfFd5z106yajC4n4OpRZ HAWffuB3MOpAfgzLatS0iL06qVwWP+lHWW75HDcZ8mKONlvnzyQgh/Oc6lLK+bRZ5M8E sLzzQbrDZ572ga2eFJG2Y7dx5eIUe/cq2M8zrB/JEoNog3f3jB8ERn5ldnAM9tIGsZDX D4rcsH7sv6LUL+NFv47i0FIXraAegOBLqsoqy7F8ci1gmzj0at3EIhMaPvPLO9n6JD6i xKVQ== X-Gm-Message-State: AEkoouvzIFHBwqJQ3kToPgMHLyLYDVHKLOxZ+Ibp8v4Sil1AwkaUFZeDyeMr2QJTfx7haQ== X-Received: by 10.66.100.162 with SMTP id ez2mr19045815pab.123.1470936903499; Thu, 11 Aug 2016 10:35:03 -0700 (PDT) Original-Received: from Vulcan.local (76-234-69-149.lightspeed.frokca.sbcglobal.net. [76.234.69.149]) by smtp.gmail.com with ESMTPSA id i62sm6787785pfg.62.2016.08.11.10.35.02 (version=TLS1 cipher=AES128-SHA bits=128/128); Thu, 11 Aug 2016 10:35:02 -0700 (PDT) X-Google-Original-From: "John Wiegley" Original-Received: by Vulcan.localdomain (Postfix, from userid 501) id 34C3D1D1AB1F; Thu, 11 Aug 2016 10:35:01 -0700 (PDT) In-Reply-To: (Stefan Monnier's message of "Wed, 10 Aug 2016 11:45:51 -0400") Mail-Followup-To: Stefan Monnier , emacs-devel@gnu.org, Mark Oteiza X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2607:f8b0:400e:c03::244 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:206567 Archived-At: >>>>> "SM" == Stefan Monnier writes: SM> I think it's the first time I see lexical-binding used for performance ;-) I really think this is an untapped area for optimization. When I did aggressive profiling, I found that up to 40% of evaluation was spent repeatedly looking up variables -- even those local to the function -- 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. 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. -- John Wiegley GPG fingerprint = 4710 CF98 AF9B 327B B80F http://newartisans.com 60E1 46C4 BD1A 7AC1 4BA2