bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#15294: 24.3.50; js2-mode parser is several times slower in lexical-b


From: Stefan Monnier
Subject: 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
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux)

> 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





reply via email to

[Prev in Thread] Current Thread [Next in Thread]