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

Re: :OPERATION-HANDLED-P slows READ



    Date: Mon, 23 Apr 90 17:24:47 -0400
    From: kanderso@DINO.BBN.COM

    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
    :READ message.

(1) :OPERATION-HANDLED-P isn't the problem

I don't think the time doing a MEMBER on a list of 92 elements is
going to dominate the time in READ unless you're reading many very
short, simple s-expressions.  I tried to crudely time the cost of the
:OPERATION-HANDLED-P message on an open file stream, and came up with
something like 200 usec on a 3650.  (My stream supported 124
operations.)  I was able to get READ to read approximately 500 atoms
per second from a file that contained only atoms, but more normal
rates were 60 - 100 forms per second.  This is about 10msec for each
call to READ, putting the 200usec overhead for :OPERATION-HANDLED-P
at around 2%.

(2) The performance of character streams is much faster in Rel 7.4.
Rel 7.4 only runs on Ivory, but character streams are noticibly faster
than the general speed-up of other computations on the Xl400.  These
improvements get back to 36xx's in Rel 8.

(3) However, using READ-FROM-STRING does seem faster.

I tried a few quick, crude timing tests comparing file read times
using :STRING-IN and READ-FROM-STRING with using READ.  I was
surprized that using :STRING-IN and READ-FROM-STRING was usually
faster than READ, and on a couple of files as much as 30-40% faster.
My results were fairly consistent on a given file.

(Methodology: This was in Release 8.0 Beta Ib.  I ran the test 6 - 10
times on each file, randomly choosing the order in which the READ and
READ-FROM-STRING versions ran.  I just used CL:TIME (on a 3650 not
running any servers), in the evening so there wasn't much network
traffic.  I used files on a remote file server; I excluded the
open/close time, and assumed that delays on the server would be
randomly distributed.  I used :STRING-IN to fill a string buffer, and
assumed that the buffer was large enough to hold any s-expression in
the file.  More details available on request.)


-- Rich
-------