Asynchronous Messaging
Gabriel Genellina
gagsl-py2 at yahoo.com.ar
Thu Sep 27 02:35:08 EDT 2007
En Thu, 27 Sep 2007 01:43:32 -0300, wink <wink at saville.com> escribi�:
> You are most correct, but Queue is slow compared to deque but
> not for the reason I guessed. Apparently it's because deque is
> implemented in C while Queue is in python. Using the program below
> it looks there is about a 35:1 speed difference.
That't not the reason. A Queue is built around a container, and it happens
to be a deque in the default implementation. But the important thing is
that a Queue is a synchronized object - it performs the necesary
synchronization to ensure proper operation even from multiple threads
attempting to use it at the same time.
So your comparison is meaningless, apart from telling that using mutexes
is not cheap.
--
Gabriel Genellina
More information about the Python-list
mailing list