# HG changeset patch # User aidan # Date 1195068340 0 # Node ID 66e2714696bd5fd39419a3c4aebf85b53761d583 # Parent c5a2b80bc4fa34655e53576b6a8f1185e6f4d07b [xemacs-hg @ 2007-11-14 19:25:39 by aidan] Make string-to-list, string-to-sequence faster, simpler (change from GNU). diff -r c5a2b80bc4fa -r 66e2714696bd lisp/ChangeLog --- 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 + + * 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 * code-files.el (write-region): diff -r c5a2b80bc4fa -r 66e2714696bd lisp/subr.el --- 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."