[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: Stefan Monnier
Subject: bug#15294: 24.3.50; js2-mode parser is several times slower in lexical-binding mode
Date: Fri, 13 Sep 2013 00:37:25 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux)

> Or is the byte compiler likely to be improved in this regard, so users
> need not be aware of it and take measures manually?

As indicated in the FIXMEs I added in src/bytecode.c at the time, the
current byte codes for unwind-protect, condition-case, and catch are
very inefficient for lexical-binding code.

I do hope to fix those issues by introducing other byte-codes which will
let us generate significantly more efficient code for those constructs,
but in 24.1, the priority was to get lexical-binding to work correctly,
performance being a secondary concern (tho for most idiomatic Elisp
code, the performance tends to be competitive).

What people should know is that

   (let (x y z)
     ...(setq x ...)
     ...(setq z ...)
     ...(setq y ...)

is often a bad idea in Elisp, and even more so in lexical-binding code
(in some cases, if a variable is immutable it can be handled
significantly more efficiently, so 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').


reply via email to

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