[Top][All Lists]

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

Re: Is byte-compiled code supposed to call `make-byte-code'?

From: Stefan Monnier
Subject: Re: Is byte-compiled code supposed to call `make-byte-code'?
Date: Wed, 25 May 2016 10:13:28 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1.50 (gnu/linux)

>> But it isn't a constant, it depends on the function's argument.
> You are right, didn't think about it. However, given that it is a
> repetetive process, shouldn't all constant parts of it be moved to C
> level instead of bytecode, as an optimization?

When Emacs-24.1 introduced lexical-binding, the focus was on:
- preserving backward compatibility.
- minimizing the amount of code changed.
- providing correct semantics.
- no speed regression.

IOW performance of lexically scoped code was not on the agenda.

Notice that the problem in the code you quote is not just the amount of
byte-code, but also in the closure that's generated: whether we hide it
inside a new "make-closure" bytecode or not, the construction of the new
closure object is more costly than in most "standard" representation
of closures (which normally only involves construction of one object,
rather than two).

So, yes, there's a fair bit of room for improvement (and not just in
this one particular spot).


reply via email to

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