emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] master 9fa9c26 2/2: Reduce face-related consing during fra


From: Ken Raeburn
Subject: [Emacs-diffs] master 9fa9c26 2/2: Reduce face-related consing during frame creation.
Date: Wed, 14 Oct 2015 02:13:43 +0000

branch: master
commit 9fa9c26e42ddb3f67133bc18112147926bae8a50
Author: Ken Raeburn <address@hidden>
Commit: Ken Raeburn <address@hidden>

    Reduce face-related consing during frame creation.
    
    * faces.el (face--attributes-unspecified): Compute the "unspecified"
    attribute list once.
    (face-spec-reset-face): Use it instead of building the list.
---
 lisp/faces.el |   11 ++++++++---
 1 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/lisp/faces.el b/lisp/faces.el
index 4e7f1a4..de8a0b5 100644
--- a/lisp/faces.el
+++ b/lisp/faces.el
@@ -1598,6 +1598,13 @@ is given, in which case return its value instead."
          result
        no-match-retval))))
 
+;; When over 80 faces get processed at frame creation time, all but
+;; one specifying all attributes as "unspecified", generating this
+;; list every time means a lot of consing.
+(defconst face--attributes-unspecified
+  (apply 'append
+         (mapcar (lambda (x) (list (car x) 'unspecified))
+                 face-attribute-name-alist)))
 
 (defun face-spec-reset-face (face &optional frame)
   "Reset all attributes of FACE on FRAME to unspecified."
@@ -1622,9 +1629,7 @@ is given, in which case return its value instead."
                                     "unspecified-fg"
                                   "unspecified-bg")))))
           ;; For all other faces, unspecify all attributes.
-          (apply 'append
-                 (mapcar (lambda (x) (list (car x) 'unspecified))
-                         face-attribute-name-alist)))))
+           face--attributes-unspecified)))
 
 (defun face-spec-set (face spec &optional spec-type)
   "Set the face spec SPEC for FACE.



reply via email to

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