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

Why is READ-CHAR so blindingly slow?

    Date: Thu, 23 Feb 89 07:38 PST
    From: rsk@SAMSON.cadr.dialnet.symbolics.com (Robert S. Kirk)

    I'm writing a special file parser and discovered that READ-CHAR is
    *much* slower than READ-LINE, even though it does little consing.
    Theoretically, READ-CHAR create its own buffer, so it sould be only
    slightly slower than READ-LINE due to extra function invocations.
MANY extra function invocations, plus a lot of extra error checking.

    I thought I could be smart by creating my own buffer and filling it with
    READ-CHAR.  Oh, well!
It seems a waste to be creating a buffer of your own when the underlying stream
is most likely buffered anyway.  Have you tried processing the data in the
system's buffers by using :READ-INPUT-BUFFER and :ADVANCE-INPUT-BUFFER.  I
think you'll find that is the most efficient way to process file data.