[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Default lexical-binding to t
From: |
Andrea Corallo |
Subject: |
Re: Default lexical-binding to t |
Date: |
Thu, 07 Nov 2024 17:10:51 -0500 |
User-agent: |
Gnus/5.13 (Gnus v5.13) |
Alan Mackenzie <acm@muc.de> writes:
> Hello, Joost.
>
> On Wed, Nov 06, 2024 at 21:48:05 +0100, Joost Kremers wrote:
>> On Wed, Nov 06 2024, Alan Mackenzie wrote:
>> > Maybe briefly explaining the philosophy of lexical binding somewhere
>> > (maybe NEWS) would help.
>
>> > I still don't understand it. I go along with lexical binding because
>> > quite a lot of people cleverer than me have said it is good. But why?
>
>> The Elisp manual has a few short remarks on it:
>
>> (info "(elisp) Lexical Binding")
>
>> ,----
>> | Lexical binding was introduced to Emacs, as an optional feature, in
>> | version 24.1. We expect its importance to increase with time. Lexical
>> | binding opens up many more opportunities for optimization, so programs
>> | using it are likely to run faster in future Emacs versions.
>
> This was several major Emacs versions ago. Has anybody actually done
> any measurements to demonstrate how effective this optimisation has
> been? When I tried comparing dynamic vs. lexical .elc versions of CC
> Mode scrolling through xdisp.c, dynamic took 8.3247s, lexical took
> 8.3285s. That's the same, within measurement accuracy.
>
>> | Lexical
>> | binding is also more compatible with concurrency, which was added to
>> | Emacs in version 26.1.
>> `----
>
> I wonder what "more" compatible means. Concurrency doesn't appear to be
> a major feature in Emacs, as far as I can tell.
>
>> and:
>
>> (info "(elisp) Dynamic Binding")
>
>> ,----
>> | Note that when code using Dynamic Binding is native compiled the
>> | native compiler will not perform any Lisp specific optimization.
>> `----
>
> This looks like a choice not to support dynamic binding as well as
> lexical binding. In my CC Mode benchmark (see above) with native
> compiled code, the lexical binding version was somewhat faster than the
> dynamic binding one, around 10%. But the native compiled code was
> scarcely faster than the byte compiled code.
I'm pretty sure the native compiler could be improved on dynamic binding
support, OTOH dynamic binding code is way less optimizable as many of
the technics the native compiler uses in order to layout efficient code
would not be applicable.
Andrea
- Re: Default lexical-binding to t, (continued)
- Re: Default lexical-binding to t, Alan Mackenzie, 2024/11/07
- Re: Default lexical-binding to t, Dmitry Gutov, 2024/11/07
- Re: Default lexical-binding to t, Eli Zaretskii, 2024/11/08
- Re: Default lexical-binding to t, Alan Mackenzie, 2024/11/08
- Re: Default lexical-binding to t, Eli Zaretskii, 2024/11/08
- Re: Default lexical-binding to t, Alan Mackenzie, 2024/11/08
- Re: Default lexical-binding to t, Stefan Monnier, 2024/11/08
- Re: Default lexical-binding to t,
Andrea Corallo <=
- Re: Default lexical-binding to t, Stefan Monnier, 2024/11/08
- Re: Default lexical-binding to t, Sean Whitton, 2024/11/06
- Re: Default lexical-binding to t, Jim Porter, 2024/11/06
- Re: Default lexical-binding to t, Stefan Monnier, 2024/11/06
- Re: Default lexical-binding to t, John Yates, 2024/11/06
- Re: Default lexical-binding to t, Stefan Monnier, 2024/11/08
- Re: Default lexical-binding to t, Jose A. Ortega Ruiz, 2024/11/06
- Re: Default lexical-binding to t, Stefan Monnier, 2024/11/08
- Re: Default lexical-binding to t, Richard Stallman, 2024/11/06
- Re: Default lexical-binding to t, Eli Zaretskii, 2024/11/07