changeset 4267:66e2714696bd

[xemacs-hg @ 2007-11-14 19:25:39 by aidan] Make string-to-list, string-to-sequence faster, simpler (change from GNU).
author aidan
date Wed, 14 Nov 2007 19:25:40 +0000
parents c5a2b80bc4fa
children 75d0292c1bff
files lisp/ChangeLog lisp/subr.el
diffstat 2 files changed, 13 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/ChangeLog	Wed Nov 14 18:51:31 2007 +0000
+++ b/lisp/ChangeLog	Wed Nov 14 19:25:40 2007 +0000
@@ -1,3 +1,12 @@
+2007-11-14  Aidan Kehoe  <kehoea@parhasard.net>
+
+	* subr.el (string-to-sequence):
+	* subr.el (string-to-list):
+	* subr.el (string-to-vector):
+	(append STRING nil) is faster than (mapcar #'identity STRING),
+	(vconcat STRING) is faster than (mapcar #'identity STRING). Change
+	from GNU. 
+
 2007-11-14  Aidan Kehoe  <kehoea@parhasard.net>
 
 	* code-files.el (write-region):
--- a/lisp/subr.el	Wed Nov 14 18:51:31 2007 +0000
+++ b/lisp/subr.el	Wed Nov 14 19:25:40 2007 +0000
@@ -947,17 +947,17 @@
 TYPE should be `list' or `vector'."
   (ecase type
     (list
-     (mapcar #'identity string))
+     (append string nil))
     (vector
-     (mapvector #'identity string))))
+     (vconcat string))))
 
 (defun string-to-list (string)
   "Return a list of characters in STRING."
-  (mapcar #'identity string))
+  (append string nil))
 
 (defun string-to-vector (string)
   "Return a vector of characters in STRING."
-  (mapvector #'identity string))
+  (vconcat string))
 
 (defun store-substring (string idx obj)
   "Embed OBJ (string or character) at index IDX of STRING."