changeset 4687:02b7c7189041

Random (minimal) performance improvements at startup. lisp/ChangeLog addition: 2009-09-06 Aidan Kehoe <kehoea@parhasard.net> * simple.el (handle-pre-motion-command-current-command-is-motion): If KEY is a character, ascertain that once, not every iteration of the loop. * mule/mule-cmds.el (finish-set-language-environment): Don't call #'string-match on a one-character string, use functions that have bytecodes instead, since this is called so often on startup.
author Aidan Kehoe <kehoea@parhasard.net>
date Sun, 06 Sep 2009 23:47:12 +0100
parents cdabd56ce1b5
children 7e54adf407a1
files lisp/ChangeLog lisp/mule/mule-cmds.el lisp/simple.el
diffstat 3 files changed, 17 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/ChangeLog	Sun Sep 06 19:36:02 2009 +0100
+++ b/lisp/ChangeLog	Sun Sep 06 23:47:12 2009 +0100
@@ -1,3 +1,13 @@
+2009-09-06  Aidan Kehoe  <kehoea@parhasard.net>
+
+	* simple.el (handle-pre-motion-command-current-command-is-motion):
+	If KEY is a character, ascertain that once, not every iteration of
+	the loop.
+	* mule/mule-cmds.el (finish-set-language-environment): 
+	Don't call #'string-match on a one-character string, use functions
+	that have bytecodes instead, since this is called so often on
+	startup. 
+
 2009-08-31  Aidan Kehoe  <kehoea@parhasard.net>
 
 	* byte-optimize.el (byte-optimize-form-code-walker): 
--- a/lisp/mule/mule-cmds.el	Sun Sep 06 19:36:02 2009 +0100
+++ b/lisp/mule/mule-cmds.el	Sun Sep 06 23:47:12 2009 +0100
@@ -771,7 +771,7 @@
   (let ((invalid-sequence-coding-system
          (get-language-info language-name 'invalid-sequence-coding-system))
         (disp-table (specifier-instance current-display-table))
-        glyph string unicode-error-lookup)
+        glyph string unicode-error-lookup first-char)
     (when (consp invalid-sequence-coding-system)
       (setq invalid-sequence-coding-system
             (car invalid-sequence-coding-system)))
@@ -788,7 +788,9 @@
 	   (when unicode-error-lookup
 	     (setq string (format "%c" unicode-error-lookup)))
            ;; Treat control characters specially:
-	   (when (string-match "^[\x00-\x1f\x80-\x9f]$" string)
+           (setq first-char (aref string 0))
+           (when (or (and (>= #x00 first-char) (<= first-char #x1f))
+                     (and (>= #x80 first-char) (<= first-char #x9f)))
 	     (setq string (format "^%c" (+ ?@ (aref string 0))))))
          (setq glyph (make-glyph (vector 'string :data string)))
          (set-glyph-face glyph 'unicode-invalid-sequence-warning-face)
--- a/lisp/simple.el	Sun Sep 06 19:36:02 2009 +0100
+++ b/lisp/simple.el	Sun Sep 06 23:47:12 2009 +0100
@@ -2091,11 +2091,12 @@
 	 ;(princ (format "key: %s mods: %s\n" key mods) 'external-debugging-output)
 	 (catch 'handle-pre-motion-command-current-command-is-motion
 	   (flet ((keysyms-equal (a b)
-		    (if (characterp a)
-			(setq a (intern (char-to-string (downcase a)))))
 		    (if (characterp b)
 			(setq b (intern (char-to-string (downcase b)))))
 		    (eq a b)))
+             (setq key (if (characterp key)
+                           (intern (char-to-string (downcase key)))
+                         key))
 	     (dolist (keysym motion-keys-for-shifted-motion)
 	       (when (if (listp keysym)
 		         (and (equal mods (butlast keysym))