diff options
| author | Eli Zaretskii | 2018-06-30 11:17:25 +0300 |
|---|---|---|
| committer | Eli Zaretskii | 2018-06-30 11:17:25 +0300 |
| commit | 3b4e65e797e15668345cf606c7d822cce11f17b2 (patch) | |
| tree | 30836d401599f6fa261407d5e6eda0192f2f0f00 /src/data.c | |
| parent | 35e9dcab5141bf9cae67abe740933fe627ecc371 (diff) | |
| download | emacs-3b4e65e797e15668345cf606c7d822cce11f17b2.tar.gz emacs-3b4e65e797e15668345cf606c7d822cce11f17b2.zip | |
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)
Diffstat (limited to 'src/data.c')
| -rw-r--r-- | src/data.c | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/src/data.c b/src/data.c index 605a5f43af7..c8beeda7208 100644 --- a/src/data.c +++ b/src/data.c | |||
| @@ -1713,11 +1713,21 @@ set_default_internal (Lisp_Object symbol, Lisp_Object value, | |||
| 1713 | set it in the buffers that don't nominally have a local value. */ | 1713 | set it in the buffers that don't nominally have a local value. */ |
| 1714 | if (idx > 0) | 1714 | if (idx > 0) |
| 1715 | { | 1715 | { |
| 1716 | struct buffer *b; | 1716 | Lisp_Object buf, tail; |
| 1717 | |||
| 1718 | /* Do this only in live buffers, so that if there are | ||
| 1719 | a lot of buffers which are dead, that doesn't slow | ||
| 1720 | down let-binding of variables that are | ||
| 1721 | automatically local when set, like | ||
| 1722 | case-fold-search. This is for Lisp programs that | ||
| 1723 | let-bind such variables in their inner loops. */ | ||
| 1724 | FOR_EACH_LIVE_BUFFER (tail, buf) | ||
| 1725 | { | ||
| 1726 | struct buffer *b = XBUFFER (buf); | ||
| 1717 | 1727 | ||
| 1718 | FOR_EACH_BUFFER (b) | 1728 | if (!PER_BUFFER_VALUE_P (b, idx)) |
| 1719 | if (!PER_BUFFER_VALUE_P (b, idx)) | 1729 | set_per_buffer_value (b, offset, value); |
| 1720 | set_per_buffer_value (b, offset, value); | 1730 | } |
| 1721 | } | 1731 | } |
| 1722 | } | 1732 | } |
| 1723 | else | 1733 | else |