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: Sun, 22 Nov 2020 18:12:29 +0200

> From: Spencer Baugh <sbaugh@catern.com>
> Date: Sat, 21 Nov 2020 21:34:29 -0500
> Cc: Spencer Baugh <sbaugh@catern.com>, Arnold Noronha <arnold@tdrhq.com>,
>  Stefan Monnier <monnier@iro.umontreal.ca>, Dmitry Gutov <dgutov@yandex.ru>
> 
> This patch series reworks access to Lisp_Object fields in struct
> buffer. The primary motivation is performance of DEFVAR_PER_BUFFER
> Lisp variables, but this also removes several now-unnecessary pieces
> of metadata and generally simplifies things.
> 
> Relative to v1, this patch series now performs a larger refactoring of
> struct buffer field access, which should provide for good performance
> while keeping the access method uniform.  I've also corrected style
> issues and bugs pointed out in review, and added some testing for
> buffer-local let variables.  (Thanks Stefan for the review, and the
> tests you added in the fix for bug#44733, both were quite helpful.)
> 
> It's possible to provide further performance improvements [...]

Thanks, but could you perhaps provide a more detailed overview of the
general idea of the changeset?  It is not easy to glean that from 16
patches, each one describing only the details of its narrow goal.
Please include in the more detailed overview indications what parts of
the series are really needed to speed up buffer-local variables and
which are cleanups in the areas of the changes not directly related to
speeding things up.

> I have an idea which would allow avoiding the mass change, if that's
> desired, which also has some additional benefits.  We could define
> getter functions (marked as inline) for each Lisp_Object field, and
> have BVAR call those field-specific getter functions by forming the
> name of the getter through token pasting.  The boilerplate of the
> getters would be kept under control by using an X macro to define both
> the fields in struct buffer and the getters. Something like:
> 
> #define FIELD_LIST \
>   C_FIELD(name) \
>   C_FIELD(filename) \
>   ...
>   LISP_FIELD(mode_line_format) \
>   ...
> 
> And then "instantiating" FIELD_LIST twice in two different contexts to
> define the Lisp_Object fields and the getters.

I don't think I have a clear idea of what will this mean in practice.
Can you show an example of its usage?

> Regardless of what approach we take, at least some level of
> benchmarking will be necessary.  Is there an established benchmark
> suite for these kinds of changes?

Is benchmark-run what you are after?  Or are you asking what use cases
of buffer-local bindings to use inside the benchmark?  If the latter,
then I guess some simple example with binding case-fold-search
followed by some regexp search would do, if you do that with various
numbers of live buffers in the session.

Thanks.



reply via email to

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