[Openmcl-devel] slow read-char

Gary Byers gb at clozure.com
Thu Jul 13 19:26:44 PDT 2006

On Fri, 14 Jul 2006, Takehiko Abe wrote:

> Gary Byers wrote:
>> My first guess would be locking, though I'm becoming an advocate of
>> saying "profile, don't guess."
>> If you're able to do WRITE-STRING "aaaaa...." instead of WRITE-CHAR,
>> should find that there's a lot less per-char overhead (including
>> locking overhead.)
> Does the locking involves in read-char too? My problem is more to
> do with read-char. (though there is a speed difference with
> write-char, I don't do write-char in the real code.)

Sorry; I realized after I sent my earlier reply that I hadn't read
your message carefully enough (and leapt to the defensive ...)

READ-CHAR has the same per-transaction locking that WRITE-CHAR has,
for much the same reasons (reading a character out of the buffer
updates a couple of pointers/counters for example, and it'd be bad -
though unlikely - for two threads to access/update a stream's state
at the same time.

> At first I suspect that OpenMCL does not do buffering, but then
> I saw buffered-stream-mixin.
> It may be my system (OSX 10.3 on an ancient G4). Has anyone
> notice the difference of read-char speed compared to another
> lisp implementation?

I run a lot of the time on a G4 iBook under 10.3.9, but I don't
call READ-CHAR a lot, either.

> Thank you,
> T.

More information about the Openmcl-devel mailing list