emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] master 3b4e65e: Speed-up let-binding of automatically-loca


From: Eli Zaretskii
Subject: [Emacs-diffs] master 3b4e65e: Speed-up let-binding of automatically-local variables
Date: Sat, 30 Jun 2018 04:18:35 -0400 (EDT)

branch: master
commit 3b4e65e797e15668345cf606c7d822cce11f17b2
Author: Eli Zaretskii <address@hidden>
Commit: Eli Zaretskii <address@hidden>

    Speed-up let-binding of automatically-local variables
    
    * src/data.c (set_default_internal): Use FOR_EACH_LIVE_BUFFER
    when binding variables that don't nominally have a local
    value, to avoid slowing down due to a large number of dead
    buffers.  (Bug#18522) (Bug#31853)
---
 src/data.c | 18 ++++++++++++++----
 1 file changed, 14 insertions(+), 4 deletions(-)

diff --git a/src/data.c b/src/data.c
index 605a5f4..c8beeda 100644
--- a/src/data.c
+++ b/src/data.c
@@ -1713,11 +1713,21 @@ set_default_internal (Lisp_Object symbol, Lisp_Object 
value,
               set it in the buffers that don't nominally have a local value.  
*/
            if (idx > 0)
              {
-               struct buffer *b;
+               Lisp_Object buf, tail;
+
+               /* Do this only in live buffers, so that if there are
+                  a lot of buffers which are dead, that doesn't slow
+                  down let-binding of variables that are
+                  automatically local when set, like
+                  case-fold-search.  This is for Lisp programs that
+                  let-bind such variables in their inner loops.  */
+               FOR_EACH_LIVE_BUFFER (tail, buf)
+                 {
+                   struct buffer *b = XBUFFER (buf);
 
-               FOR_EACH_BUFFER (b)
-                 if (!PER_BUFFER_VALUE_P (b, idx))
-                   set_per_buffer_value (b, offset, value);
+                   if (!PER_BUFFER_VALUE_P (b, idx))
+                     set_per_buffer_value (b, offset, value);
+                 }
              }
          }
        else



reply via email to

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