GNU bug report logs -
#15294
24.3.50; js2-mode parser is several times slower in lexical-binding mode
Previous Next
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
View this message in rfc822 format
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.
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.