emacs-devel
[Top][All Lists]
Advanced

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

[PATCH 00/10] Speeding up DEFVAR_PER_BUFFER (Was: ido-switch-buffer is s


From: Spencer Baugh
Subject: [PATCH 00/10] Speeding up DEFVAR_PER_BUFFER (Was: ido-switch-buffer is slow)
Date: Thu, 19 Nov 2020 10:38:04 -0500

Here is my first attempt at speeding up DEFVAR_PER_BUFFER. I would
greatly appreciate review/comments. This is just a first attempt and
will certainly need some cleanup.

Here is a simple benchmark just for DEFVAR_PER_BUFFER:

(benchmark-run 500000 (let ((case-fold-search nil)) (string-match "" "")))
; unpatched emacs: (0.6872330339999999 0 0.0)
; patched emacs: (0.608068564 0 0.0)
(setq my-buffer-list nil)
(dotimes (idx 1000) (push (get-buffer-create (format "test-buffer:%s" idx)) 
my-buffer-list))

(benchmark-run 500000 (let ((case-fold-search nil)) (string-match "" "")))
; unpatched emacs: (18.591189848 0 0.0)
; patched emacs: (0.5885462539999999 0 0.0)

There's some measurement noise, but the patch does indeed eliminate
the performance overhead of let-binding DEFVAR_PER_BUFFER when there
are large numbers of buffers. A 40x speedup is not too shabby. :)

The last two patches are the core of the change.  Most of the rest of
the patch series is simple preparatory changes for changing the
definition of the BVAR macro.

Spencer Baugh (10):
  Take buffer field name in DEFVAR_PER_BUFFER
  Add bset_save_length and use it
  Use bset_last_selected_window everywhere
  Use bset_enable_multibyte_characters everywhere
  Add BVAR_DEFAULT for access to buffer defaults
  Disallow using BVAR as an lvalue
  Reorder buffer.h for upcoming rework of BVAR
  Make cache_long_scans buffer-local when setting it
  Access buffer_defaults in BVAR if there's no local binding
  Don't iterate over all buffers in set_default_internal

 src/buffer.c   | 243 +++++++++++++++++++-------------------
 src/buffer.h   | 313 +++++++++++++++++++++++++++----------------------
 src/category.h |   2 +-
 src/data.c     |  30 +----
 src/eval.c     |  18 ++-
 src/fileio.c   |  12 +-
 src/syntax.h   |   2 +-
 src/window.c   |   5 +-
 8 files changed, 320 insertions(+), 305 deletions(-)

-- 
2.28.0




reply via email to

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