Re: big strings

[email protected] (Raymond Toy (RT/EUS))
Newsgroups gmane.lisp.cmucl.general
Message-ID <[email protected]>
>>>>> "WP" == Walter C Pelissero <[email protected]> writes:

    WP> On 19D the following code will cause an error:
    WP> * (defun test-string-stream ()
    WP>   (with-output-to-string (stream)
    WP>     (dotimes (x 17)
    WP>       (write-string (make-string (* 1024 1024)) stream)))
    WP>   (values))

Thanks for the neat bug.

[snip]

    WP> The following code gets rid of the bug in the string streams, although
    WP> there may be a more serious error somewhere else, as I haven't been
    WP> able to track down the call to BIT-BASH-COPY.

BIT-BASH-COPY is called because of a DEFTRANSFORM for REPLACE, which
is used in string-sout.

    WP> (in-package :lisp)

Thanks for the replacement.  The only possible issue with the
replacement would be performance.  BIT-BASH-COPY tries pretty hard to
do word copies.  And BIT-BASH-COPY is intended to be able to copy
arbitrary bit strings.  I don't know why it's limited to
(unsigned-byte 27) offsets.  Perhaps to make sure the bit index stays
as a 32-bit int?

And since the transform for REPLACE operates on simple strings, we
could probably just call out to memcpy and depend on the OS to have an
efficient implementation of memcpy, which is probably true these days.

Ray
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.