]> code.delx.au - gnu-emacs/commitdiff
Speed up lookup in redisplay--variables
authorEli Zaretskii <eliz@gnu.org>
Sat, 7 Nov 2015 13:32:45 +0000 (15:32 +0200)
committerEli Zaretskii <eliz@gnu.org>
Sat, 7 Nov 2015 13:32:45 +0000 (15:32 +0200)
* lisp/frame.el (redisplay--variables): Make it a hash-table.

* src/xdisp.c (maybe_set_redisplay): Access redisplay--variables
as a hash-table.  This speeds up this function by an order of
magnitude: where previously a setq was slowed down by 100% by
introducing the maybe_set_redisplay test, it is now only 5%
slower.
(syms_of_xdisp) <redisplay--variables>: Doc fix.

lisp/frame.el
src/xdisp.c

index 4b23cb20ac46e76ab8ee4b711cfd9fe9aca816a9..3f31a2973c6073fd67c6b01b0c8b85235b37c87e 100644 (file)
@@ -2231,8 +2231,10 @@ See also `toggle-frame-maximized'."
 (make-obsolete-variable
  'window-system-version "it does not give useful information." "24.3")
 
-;; These variables should trigger redisplay of the current buffer.
-(setq redisplay--variables
+;; Variables which should trigger redisplay of the current buffer.
+(setq redisplay--variables (make-hash-table :test 'eq :size 10))
+(mapc (lambda (var)
+        (puthash var 1 redisplay--variables))
       '(line-spacing
         overline-margin
         line-prefix
index dbc2d840d44679d0dfdc0ed1f36b530c8a2ee116..30dfac556014a1419bee08a292db8f5879a9ea00 100644 (file)
@@ -623,7 +623,8 @@ bset_update_mode_line (struct buffer *b)
 void
 maybe_set_redisplay (Lisp_Object symbol)
 {
-  if (!NILP (Fassoc_string (symbol, Vredisplay__variables, Qnil)))
+  if (HASH_TABLE_P (Vredisplay__variables)
+      && hash_lookup (XHASH_TABLE (Vredisplay__variables), symbol, NULL) >= 0)
     {
       bset_update_mode_line (current_buffer);
       current_buffer->prevent_redisplay_optimizations_p = true;
@@ -31478,7 +31479,7 @@ display table takes effect; in this case, Emacs does not consult
   Vredisplay__mode_lines_cause = Fmake_hash_table (0, NULL);
 
   DEFVAR_LISP ("redisplay--variables", Vredisplay__variables,
-     doc: /* A list of variables changes to which trigger a thorough redisplay.  */);
+     doc: /* A hash-table of variables changing which triggers a thorough redisplay.  */);
   Vredisplay__variables = Qnil;
 }