[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: fast string and number output to a stream
- To: info-mcl@ministry.cambridge.apple.com
- Subject: Re: fast string and number output to a stream
- From: poeck@informatik.uni-wuerzburg.de (Karsten Poeck)
- Date: 3 Jun 1994 14:33:20 GMT
- Followup-to: comp.lang.lisp.mcl
- Newsgroups: comp.lang.lisp.mcl
- Organization: University of Wuerzburg
- References: <Cqtnpx.90J@cc.umontreal.ca>
In article <Cqtnpx.90J@cc.umontreal.ca>, kardank@ERE.UMontreal.CA (Kardan
Kaveh) wrote:
> What is the fastest way of writing strings and numbers to a stream? None
> of the ways I have tried seems to be much faster than simply using format.
>
For Strings
(defun save-a-string (string function value stream)
(declare (ignore stream))
(dovector (char string)
(when (char= char #\")
(funcall function value #\\))
(funcall function value char)
)
)
(defun save-a-string-to-an-open-stream (string stream)
(multiple-value-bind
(a b)
(stream-writer stream)
(save-a-string string a b stream)))
;(save-a-string-to-an-open-stream "ddddd" *standard-output*)
I have something like this for fixnums too, but you might as well call
print-object for numbers
Karsten