Robert Strandh asked:
Yes. Could this be solved by simply adding stream-read-sequence and stream-write-sequence methods to the protocol?
Definitely yes. Doing 100 operations of the same kind with the preparations (the CLOS dispatch, fetching the buffer pointer etc.) once is always faster than doing 100 times the preparation and one operation.
For example, CLISP's internal FILL-STREAM became 5 or 10 times faster when we implemented not only the STREAM-WRITE-CHAR function but also the STREAM-WRITE-CHAR-SEQUENCE function.
Btw, I propose to use STREAM-READ-CHAR-SEQUENCE and STREAM-READ-BYTE-SEQUENCE instead of STREAM-READ-SEQUENCE, and similarly STREAM-WRITE-CHAR-SEQUENCE and STREAM-WRITE-BYTE-SEQUENCE instead of STREAM-WRITE-SEQUENCE. Reason: - There are streams with element type (OR INTEGER CHARACTER). - It's unnecessary overhead to let the element type guessing be done at each invocation of these functions. - The precise rules for this guessing are unspecified by ANSI CL and therefore implementation dependent.
Bruno