[squeak-dev] SharedQueue does scale

Göran Krampe goran at krampe.se
Tue Oct 19 03:28:04 UTC 2010


Hi all!

On 10/18/2010 09:38 PM, Levente Uzonyi wrote:
> On Mon, 18 Oct 2010, Göran Krampe wrote:
>
>> Hi guys!
>>
>> I am in China and haven't read this thread etc, but regarding improved
>> SharedQueue - have you looked at SharedStreams:
>>
>> http://map.squeak.org/packagebyname/sharedstreams
>>
>> ...the SharedBufferStream in there was much faster for lots of objects
>> or characters, since it relied on primitives. In fact, a looooong time
>> ago Stephen Pair thought it should have replaced SharedQueue.
>
> I just checked it. It works like SharedQueue, but it seems to be
> designed to hold Characters (#nextLine, #nextLineCr, etc). It also works

Yes, it was - originally. But then I think we did a few tiny tweaks to 
make it work with any objects. IIRC I also think we found some buglets 
in SharedQueue when writing SharedStreams.

Sidenote: The SharedBidirectionalStream is a kinda fun class - it uses 
two SharedBufferStreams internally "cross connected" so that it can act 
as a in-image approximation of a SocketStream. We built this for a 
multiplexer/demultiplexer originally so that multiple Squeak processes 
could talk to a remote computer and share a single Socket using small 
"packets".

> with arrays, so it can be a replacement of SharedQueue. It's design is
> similar to SharedQueue's. It uses a Semaphore for synchronization. I
> don't see where it relies on primitives, but relying on them nowadays is
> not future proof. The performance of pure smalltalk code is on par or
> better than some primitives with CogVM.
 >
> Here are the results for the three benchmarks I did with an Array as
> buffer:
>
> SharedBufferStream->#(#(1052 1309) #(521 533) #(530 543) #(532 537)
> #(530 530)).
>
> SharedBufferStream->#(#(525 537) #(556 518) #(490 576) #(530 542) #(547
> 532)).
>
> SharedBufferStream->#(4253 1990 3099 2089 2928).
>
> For the first two benchmarks the results a bit worse than the "new"
> SharedQueue's, for the third it's sometimes better, sometimes worse.
> Anyway it's still an order of magnitude slower than Igor's atomic
> collections.

Great! ;)

> Btw SharedBufferStream >> #makeRoomAtEndFor: seems to have at least 2
> bugs, after fixing one of them the thrid benchmark gives a bit smoother
> results:
> SharedBufferStream->#(3010 2894 2034 3028 3014)
>
>
> Levente

Super thanks Levente for taking a look! Then we can put that package to 
rest I presume. Again, thank you very much.

regards, Göran



More information about the Squeak-dev mailing list