GNU bug report logs - #15294
24.3.50; js2-mode parser is several times slower in lexical-binding mode

Previous Next

Package: emacs;

Reported by: Dmitry Gutov <dgutov <at> yandex.ru>

Date: Fri, 6 Sep 2013 21:01:02 UTC

Severity: normal

Found in version 24.3.50

Done: Stefan Monnier <monnier <at> iro.umontreal.ca>

Bug is archived. No further changes may be made.

Full log


Message #21 received at 15294 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Dmitry Gutov <dgutov <at> yandex.ru>
Cc: 15294 <at> debbugs.gnu.org
Subject: Re: bug#15294: 24.3.50;
 js2-mode parser is several times slower in lexical-binding mode
Date: Mon, 09 Sep 2013 22:04:38 -0400
> If I append -*- lexical-binding: t -*- to the first line of js2-mode.el
> and eval the buffer, parsing a file takes several (3 to 4) times longer.

[ I'm disregarding the interpreted time for now, since the issues are
  likely to be different. ]

In the compiled case, loading js2-mode-lexical.elc and then redefining
`js2-get-token' to the value it has in js2-mode-dynamic.elc brings me
back the same speed as with js2-mode-dynamic.elc.
IOW the slowdown is in js2-get-token.

If it indeed comes from the handling of catch/throw, then there are two
ways to fix it:
- provide a new byte-code for catch which does not require wrapping the
  body in a closure.  This should not be terribly difficult and would
  benefit all existing code, but it does require changes to the way
  catch is implemented.
- improve the byte-compiler so it can compile away cl-block/cl-return.
  This should not require new byte-codes, but requires delving "deepish"
  into the byte-compiler.


        Stefan




This bug report was last modified 10 years and 240 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.