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

I/O efficiency question




I have an Allegro 4.1 program (running on a Sun Sparcstation-II) which
does file i/o with large files (over a megabyte).  I am trying to optimize
the file i/o and noticed that 'read-char' and 'write-char' are fairly
slow, the reason being that they first call for example:
(METHOD STREAM:STREAM-READ-CHAR
  (STREAM:FUNDAMENTAL-CHARACTER-INPUT-STREAM))

and then: stream:stream-read-char.

  When I tried calling stream:stream-read-char directly, it went faster
but still tried invoking the (METHOD STREAM:STREAM-READ-CHAR ...).

  By calling EXCL::STM-FILE-BUFFERED-READ-CHAR and
EXCL::STM-FILE-BUFFERED-WRITE-CHAR  directly I was able to bypass
the method stuff, speeding up my program considerably (45%).

  I would rather not call internal Allegro functions, but I can't seem
to find a way around this.  I tried putting a
  (declare (type STREAM:FUNDAMENTAL-CHARACTER-INPUT-STREAM stream)) and
  (declare (optimize (speed 3) (safety 0) (debug 0)))

  in my read/write functions, but this didn't seem to help.

  So my question is, is there a more elagent way to do this, and if not,
why not make the compiler bypass the method stuff for read-char and write-char
if it knows that the type is a character stream?


Thanks,

	Pete Shell  pshell@cmu.edu