[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
:OPERATION-HANDLED-P slows READ
Date: Mon, 23 Apr 90 18:20 EDT
From: SWM@SAPSUCKER.SCRC.Symbolics.COM (Scott McKay)
Date: Mon, 23 Apr 90 17:24:47 -0400
READing from a string is about twice as fast than reading from a
stream. In fact, reading each line of a file into a string and then
reading from the string is twice as fast as just reading the file.
The main difference is due to (SEND STREAM :OPERATION-HANDLED-P :READ)
which is called by an internal read function. In a typical file
stream this requires MEMBERing down a list of 92 items, while when
reading from a string, the list is quite short.
So by having streams optimize this case you can double the performance
of READ. In the 7.2 world i'm using, at least, no stream handles the
Hasn't there already been a long discussion of this on SLUG already?
READ is much faster in 7.4 and 8.0 than it was in 7.2. I honestly don't
know if having streams support :READ directly will make a large
difference in 8.0. Since 8.0 starts shipping pretty soon, you won't
have much longer to wait to find out...
I don't think he is suggesting that streams handle :READ directly. I
interpret the suggestion to be to optimize away the :OPERATION-HANDLED-P
somehow, since no stream flavors actually implement it (actually, with C
Runtime loaded, the C streams handle :READ, but I think their :READ
methods implement a Unix-like read() rather than Lisp (READ)!).