From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Dmitry Gutov Newsgroups: gmane.emacs.bugs Subject: bug#15294: 24.3.50; js2-mode parser is several times slower in lexical-binding mode Date: Sat, 14 Sep 2013 07:20:29 +0300 Message-ID: <5233E40D.4000102@yandex.ru> References: <871u51ll93.fsf@yandex.ru> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1379132480 24949 80.91.229.3 (14 Sep 2013 04:21:20 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 14 Sep 2013 04:21:20 +0000 (UTC) Cc: 15294@debbugs.gnu.org To: Stefan Monnier Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sat Sep 14 06:21:22 2013 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1VKhMH-000725-D7 for geb-bug-gnu-emacs@m.gmane.org; Sat, 14 Sep 2013 06:21:21 +0200 Original-Received: from localhost ([::1]:51930 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VKhMG-0001Y0-Pl for geb-bug-gnu-emacs@m.gmane.org; Sat, 14 Sep 2013 00:21:20 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:37092) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VKhM6-0001XM-Fh for bug-gnu-emacs@gnu.org; Sat, 14 Sep 2013 00:21:17 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VKhLz-00026t-4Z for bug-gnu-emacs@gnu.org; Sat, 14 Sep 2013 00:21:10 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:55291) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VKhLz-00026p-0V for bug-gnu-emacs@gnu.org; Sat, 14 Sep 2013 00:21:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1VKhLy-0006po-PU for bug-gnu-emacs@gnu.org; Sat, 14 Sep 2013 00:21:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Dmitry Gutov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 14 Sep 2013 04:21:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 15294 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 15294-submit@debbugs.gnu.org id=B15294.137913244826239 (code B ref 15294); Sat, 14 Sep 2013 04:21:02 +0000 Original-Received: (at 15294) by debbugs.gnu.org; 14 Sep 2013 04:20:48 +0000 Original-Received: from localhost ([127.0.0.1]:35349 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VKhLj-0006p9-U1 for submit@debbugs.gnu.org; Sat, 14 Sep 2013 00:20:48 -0400 Original-Received: from mail-ea0-f172.google.com ([209.85.215.172]:62201) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VKhLb-0006om-C0 for 15294@debbugs.gnu.org; Sat, 14 Sep 2013 00:20:40 -0400 Original-Received: by mail-ea0-f172.google.com with SMTP id r16so938061ead.17 for <15294@debbugs.gnu.org>; Fri, 13 Sep 2013 21:20:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:content-type:content-transfer-encoding; bh=fYjrtWR9pV82y++vSF+jIVUgL1OujK0Bo24pi1R6v8Q=; b=W6avwKVIu7YJi+kX/5eADJipL7Qxijyv7B06AJYSL7vkvFnvdKrfvZ0ZaI9Y/Nx2yW 5QH4zGtyLEEFugcsqjW9GPA5tG5keWP0WCd5y4nU6FgKmdwxG0gGZEm7LsJB2Dx06qpO fGlnkh9zwSp3D+gwdtfGEAgBaZaMx3j6ksa+iRupeZEeT3DstEN+FygLR7bBAWvtZbBN zOgoHk5R/kqwoVmzNFqD4RkoUNw/vdM4FMDH+fy7OZOCbIwpf3k1VpnT3dwKMB3d8imW V3ydpyuBBVunS3N25Gke+yK0MuHdzHnnxke850HLQO6MammyHrcS9nFK+Nem23ZZ4nCJ EUGg== X-Received: by 10.15.94.201 with SMTP id bb49mr23487435eeb.23.1379132432870; Fri, 13 Sep 2013 21:20:32 -0700 (PDT) Original-Received: from [192.168.10.2] (62-118-214.netrun.cytanet.com.cy. [62.228.118.214]) by mx.google.com with ESMTPSA id bn13sm20512336eeb.11.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 13 Sep 2013 21:20:32 -0700 (PDT) User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130803 Thunderbird/17.0.8 In-Reply-To: X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:78378 Archived-At: On 13.09.2013 06:40, Stefan Monnier wrote: > It seems the slowdown is indeed linked to the way `catch' is handled > (indeed, this non-idiomatic ELisp code ends up byte-compiled in a really > poor way). What's non-idiomatic about this use of `catch'? > The trivial patch below brings the time down from 5s to 2.6s (as > compared to 2.1s for the dynamic-binding version). Indeed, it does, in the compiled mode (but please don't install it yet, because it'll complicate merging the `arrow-functions' branch(*)). It does not make much of a difference in the interpreted mode. Now that we have eager macro-expansion, I was rather happy that interpreted js2-mode performance is only like 2x worse than when compiled. But 2.6 vs 2.1, it still a noticeable regression. Do you suppose the usage of `setq' is the main contributor? Speaking of byte-code changes, that seems like a fine idea, but ideally the code should work similarly well on Emacs 24.1-24.3. Or we can just hold off on making js2-mode switch to lexical-binding until [long] after 24.4 is out. (*) Would you take a look at it, too? It has quite a few changes in `js2-get-token' and related functions. They also make performing the same change as in your patch more difficult, since I'm actually using the value returned by `catch' before returning from the function. On 13.09.2013 07:37, Stefan Monnier wrote: > the mere existence of a single `setq' > on a variable can sometimes slow other chunks of code: in many cases > `let' is cheaper than `setq'). I see. Does this also extend to `setf' and its defstruct-related functionality? It's all over the js2-mode codebase.