[Top][All Lists]

[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: Dmitry Gutov
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
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130803 Thunderbird/17.0.8

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.

reply via email to

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