[squeak-dev] SharedQueue does scale
Levente Uzonyi
leves at elte.hu
Mon Oct 18 19:38:04 UTC 2010
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 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.
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
>
> regards, Göran
>
>
More information about the Squeak-dev
mailing list
|