emacs-devel
[Top][All Lists]
Advanced

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

Re: [PATCH v2 00/16] Speeding up DEFVAR_PER_BUFFER


From: Eli Zaretskii
Subject: Re: [PATCH v2 00/16] Speeding up DEFVAR_PER_BUFFER
Date: Tue, 01 Dec 2020 17:10:56 +0200

> From: Spencer Baugh <sbaugh@catern.com>
> Cc: emacs-devel@gnu.org, arnold@tdrhq.com, monnier@iro.umontreal.ca,
>  dgutov@yandex.ru, rms@gnu.org
> Date: Mon, 30 Nov 2020 15:11:31 -0500
> 
> > But OTOH, referencing buffer-local values through BVAR is now slower,
> > about twice slower, I guess?  For example, the display code has 90
> > uses of BVAR, and they will now be slower.  I wonder what that means
> > for us: we are making let-binding of local variables much faster, but
> > "punish" the code that just accesses these variables in our inner
> > loops.
> 
> Yes, it's probably a trade-off.

In fact, the current code is slow only when the buffer that's current
at the moment of the let-binding doesn't have a buffer-local value for
the variable.  Because if the current buffer does have a local value,
the let-binding simply changes that single local value.

So in effect we make every access to built-in buffer-local variables
pay for the single use case when the let-binding is done in a buffer
that has no local value.  I'm not sure how to assess this kind of
trade-off.

> My guess is that the extra overhead of BVAR will not be significant,
> but benchmarking is the only way to know for sure.

We should benchmark, but coming up with suitable use cases to make
these measurements is not easy.



reply via email to

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