Re: Asynchronous Messaging

2007-09-27 Thread Gabriel Genellina
En Fri, 28 Sep 2007 00:52:57 -0300, wink <[EMAIL PROTECTED]> escribi�: > Interesting, from the documentation for deque says; > "Deques support thread-safe, ..." which would seem to > imply a mutex of some sort would be used. But in > looking at collectionsmodule.c for 2.5.1 I don't see > any mutex

Re: Asynchronous Messaging

2007-09-27 Thread wink
> > 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 > attem

Re: Asynchronous Messaging

2007-09-26 Thread Gabriel Genellina
En Thu, 27 Sep 2007 01:43:32 -0300, wink <[EMAIL PROTECTED]> 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 3

Re: Asynchronous Messaging

2007-09-26 Thread wink
Fredrik, 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. 100 d.append 0.11s 0.1097us p

Re: Asynchronous Messaging

2007-09-26 Thread Fredrik Lundh
wink wrote: > But its performance is poor if the number of items on a > Queue becomes large because it is implemented using a list. > One of the things I was thinking of was doing another implementation > using of Queue which was based on deque. Updating from 2.3 to something newer will fix that

Re: Asynchronous Messaging

2007-09-26 Thread wink
On Sep 26, 4:47 am, wink <[EMAIL PROTECTED]> wrote: To make it easier to comment on the code, I'm including "mproc.py" file below. Fredrik, was commenting about using Queue and in fact I do. Queue is quite nice and is also thread safe, which is a requirement for this implementation. But its perform

Re: Asynchronous Messaging

2007-09-26 Thread A.T.Hofkamp
On 2007-09-26, wink <[EMAIL PROTECTED]> wrote: > Hello, > > I'm getting my feet wet in Python and thought I'd try to see how well > Python works for asynchronous messaging. I've been using asynchronous Have a look at Twisted (www.twistedmatrix.com) Albert -

Re: Asynchronous Messaging

2007-09-26 Thread Fredrik Lundh
wink wrote: > This provides two benefits, a sender is never directly effected by the > receiver and since the receiver handles only one message at a time > it generally never has to use mutexes or semaphores. This allows for > the programmer to use multiple threads without having to contend with t

Asynchronous Messaging

2007-09-26 Thread wink
Hello, I'm getting my feet wet in Python and thought I'd try to see how well Python works for asynchronous messaging. I've been using asynchronous messaging for 5 years and find it advantageous for many things. In the scheme I use communication is not only asynchronous but