[climacs-cvs] CVS update: climacs/buffer.lisp climacs/io.lisp

Robert Strandh rstrandh at common-lisp.net
Tue Dec 28 06:58:38 UTC 2004


Update of /project/climacs/cvsroot/climacs
In directory common-lisp.net:/tmp/cvs-serv7130

Modified Files:
	buffer.lisp io.lisp 
Log Message:
Improved performance of loading a file by employing an new addition to
the Flexichain library.  You will have to update your Flexichain
directory from CVS in order for this to work.


Date: Tue Dec 28 07:58:36 2004
Author: rstrandh

Index: climacs/buffer.lisp
diff -u climacs/buffer.lisp:1.11 climacs/buffer.lisp:1.12
--- climacs/buffer.lisp:1.11	Fri Dec 24 09:21:34 2004
+++ climacs/buffer.lisp	Tue Dec 28 07:58:36 2004
@@ -327,9 +327,7 @@
 sequence."))
       
 (defmethod insert-buffer-sequence ((buffer standard-buffer) offset sequence)
-  (loop for elem across sequence
-	do (insert-buffer-object buffer offset elem)
-	   (incf offset)))
+  (insert-vector* (slot-value buffer 'contents) offset sequence))
 
 (defgeneric insert-object (mark object)
   (:documentation "Insert the object at the mark.  This function simply calls


Index: climacs/io.lisp
diff -u climacs/io.lisp:1.2 climacs/io.lisp:1.3
--- climacs/io.lisp:1.2	Thu Dec 23 09:00:33 2004
+++ climacs/io.lisp	Tue Dec 28 07:58:36 2004
@@ -23,11 +23,14 @@
 (in-package :climacs-base)
 
 (defun input-from-stream (stream buffer offset)
-  (let ((eof-object (cons nil nil)))
-    (loop for obj = (read-char stream nil eof-object)
-	  until (eq obj eof-object)
-	  do (insert-buffer-object buffer offset obj)
-	     (incf offset))))
+  (loop with vec = (make-array 10000 :element-type 'character)
+	for count = (read-sequence vec stream)
+	while (plusp count)
+	do (if (= count (length vec))
+	       (insert-buffer-sequence buffer offset vec)
+	       (insert-buffer-sequence buffer offset
+				       (subseq vec 0 count)))
+	   (incf offset count)))
 
 (defun output-to-stream (stream buffer offset1 offset2)
   (loop for offset from offset1 below offset2




More information about the Climacs-cvs mailing list