Changeset 8892


Ignore:
Timestamp:
Mar 26, 2008, 10:52:33 AM (11 years ago)
Author:
gb
Message:

Reduce the cost of using recycled simple-string-output-streams a bit:
don't pass the result of (MAKE-STRING 40) to the constructor, since
there's a fairly good chance that we'll recycle a string-stream-ioblock
that already has a string. When doing WRITE-CHAR on a string-output
stream, handle the 0-length string case and make something of more
reasonable length then.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/working-0711/ccl/level-1/l1-streams.lisp

    r8677 r8892  
    43364336    (incf (ioblock-charpos ioblock)))
    43374337  (if (= index len)
    4338       (let* ((newlen (+ len len))      ;non-zero !
     4338      (let* ((newlen (if (zerop len) 20 (+ len len)))      ;non-zero !
    43394339             (new (make-string newlen)))
    43404340        (%copy-ivector-to-ivector string 0 new 0 (the fixnum (ash len 2)))
     
    43884388
    43894389(defun make-simple-string-output-stream ()
     4390  ;; There's a good chance that we'll get a recycled ioblock
     4391  ;; that already has a string; if not, we defer actually
     4392  ;; creating a usable string until write-char
    43904393  (%%make-string-output-stream *string-output-stream-class*
    4391                                (make-string 40)
     4394                               ""
    43924395                               'string-output-stream-ioblock-write-char
    43934396                               'string-output-stream-ioblock-write-simple-string))
Note: See TracChangeset for help on using the changeset viewer.