[squeak-dev] SharedQueue doesn't scale

Stéphane Ducasse stephane.ducasse at inria.fr
Sun Oct 17 09:01:13 UTC 2010


Igor sorry we were busy running around :)
So could you summarize
	with pros and cons
	with potential path for the next actions
	May be we should schedule something for 1.3

Stef


On Oct 16, 2010, at 4:19 AM, Igor Stasenko wrote:

> Hello,
> 
> just out of interest, i tried to compare the speed of my FIFOQueue
> implementation and SharedQueue,
> using Levente's benchmarks for stack:
> 
> "The linked Stack implementation"
> (1 to: 5) collect: [ :run |
>       | stack |
>       Smalltalk garbageCollect.
>       stack := FIFOQueue new.
>       {
>               [ 1 to: 1000000 do: [ :each | stack nextPut: each ] ] timeToRun.
>               [ 1 to: 1000000 do: [ :each | stack next ] ] timeToRun } ]
> 
> #(#(291 69) #(170 65) #(168 66) #(168 65) #(168 65))
> 
> Then i changed FIFOQueue  to SharedQueue and run it again..
> waiting 1 minute.. wait a bit more.. then i came to smoke.. and after
> returning, it was still running..
> i interrupted it, and inspected the queue size.. it was slightly above
> 300000 items.
> 
> Of course, SharedQueue usually not used in scenarios, where you need
> to push such large number of items.
> So, its just a warning.
> 
> Btw, here is another comparison (Stack vs thread-safe LIFO queue):
> 
> (1 to: 5) collect: [ :run |
>       | stack |
>       Smalltalk garbageCollect.
>       stack := Stack new.
>       {
>               [ 1 to: 1000000 do: [ :each | stack push: each ] ] timeToRun.
>               [ 1 to: 1000000 do: [ :each | stack pop ] ] timeToRun } ]
> 
> Stack:
>   #(#(166 94) #(160 90) #(162 91) #(162 92) #(160 92))
> 
> LIFOQueue:
> #(#(172 250) #(174 248) #(172 250) #(174 252) #(172 250))
> 
> Yes, it is slower (mainly for reading). But it is price for being thread safe :)
> 
> 
> -- 
> Best regards,
> Igor Stasenko AKA sig.
> 




More information about the Squeak-dev mailing list