[COMMIT] Make string-to-list, string-to-sequence faster, simpler (change from GNU)

Aidan Kehoe kehoea at parhasard.net
Wed Nov 14 14:28:25 EST 2007


APPROVE COMMIT

NOTE: This patch has been committed.

lisp/ChangeLog addition:

2007-11-14  Aidan Kehoe  <kehoea at 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. 


XEmacs Trunk source patch:
Diff command:   cvs -q diff -Nu
Files affected: lisp/subr.el
===================================================================
RCS

Index: lisp/subr.el
===================================================================
RCS file: /pack/xemacscvs/XEmacs/xemacs/lisp/subr.el,v
retrieving revision 1.43
diff -u -u -r1.43 subr.el
--- lisp/subr.el	2007/11/14 18:51:31	1.43
+++ lisp/subr.el	2007/11/14 19:23:25
@@ -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."

-- 
On the quay of the little Black Sea port, where the rescued pair came once
more into contact with civilization, Dobrinton was bitten by a dog which was
assumed to be mad, though it may only have been indiscriminating. (Saki)



More information about the XEmacs-Patches mailing list