[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: A plethora of MCL questions

>* On a related note:  I have metered stream-write-string and it's a bit
>faster than write-string.  Is there something faster (e.g.  a system
You could try stream-writer, but it is not that faster

(defun really-fast-write-string (a-string function value)
  (declare (optimize (speed 3)(safety 0))
           (simple-string a-string))
  (dotimes (index (length a-string))
    (funcall function value (schar a-string index))))

(defun test (n m how)
  (let ((string (make-string n :initial-element #\a))
        (file (merge-pathnames "test"))
    (when (probe-file file)
      (delete-file file))
    (with-open-file (stream file :if-does-not-exist :create
                            :direction :output)
        (function value)
        (stream-writer stream)
        (ecase how
            (dotimes (x m)
              (write-string string stream))))
            (dotimes (x m)
              (really-fast-write-string string function value)))))))))

(test 1000 100 :write-string)
(test 1000 100 :really-fast-write-string)
>* Is there some code somewhere which shows how to capture stream output
>for really fast redisplay? (e.g. call the display function once, output
>it to some records of some sort and that's it- a la CLIM output

Yes, thats done with pictures

to store the picture assuminf the view has an accessor picture
(start-picture views)
  (setf (picture view) (get-picture views)))

to display it (draw-picture view (picture view))

Every with-focused-view sets the cliprect to the current visible region of
the window, sou you might end up using traps