[ENH]Shared streams (v 0.9)
David T. Lewis
lewis at mail.msen.com
Fri Apr 12 02:52:07 UTC 2002
On Thu, Apr 11, 2002 at 11:37:11AM +0100, goran.hultgren at bluefish.se wrote:
> After some small testing I conclude that SharedBufferStream is much
> faster than the class InternalPipe in OSProcess. Sorry David! :-)
> InternalPipe uses a SharedQueue of single characters which makes it a
> magnitude slower (30-50 times on some simple tests with random length
> Strings on in/out, single producer/consumer).
> Another thing to note is that InternalPipe is not "safe" for multiple
> consumers/producers - it has no protection for consumers or producers
> "stealing" characters from each other. SharedBufferStream makes sure
> that operations like nextLine, nextPutAll, next: etc are atomic.
That sounds right to me. InternalPipe was just some basic streaming
behavior wrapped around a SharedQueue, and it worked well enough for
my purposes. Your SharedBufferStream looks very good.
By the way, I remember being very surprised when I went looking for
a FIFO class, and the only thing I could find in the image was a
SharedQueue. Somehow I had expected that this was one of the fundamental
things that would just be there. Maybe lots of folks write little hacks
More information about the Squeak-dev