[python-win32] Efficiency question

Myddrin myddrin at myddrin.com
Tue Dec 16 19:53:15 EST 2003


Hi,

	I'm using a python Queue object to pass information between threads.  
Currently, I'm using a blocking Queue.get call and when one thread needs to 
wait on new information from another thread.  This implementation works 
great, but I'm trying to get my CPU and Memory usage to a minimum.  I'm 
half-way through Skip Montanaro's "Python Peformance Tips," but I got 
thinking.  The performance right now is very good, but when alot of 
information is passing between two threads, the process can start taking up a 
goodly chunk of the CPU (up to about 20% on a 1 Ghz machine).

	Would using win32event module or the python condition class be more 
efficient, or are the locking classes utilized by Queue about as effiecient 
as anything else?  Cross-platform solutions are preferred, but not required 
so if I can shave some cycles, I'll happily re-write the same code for the 
other platforms.  [Well, ok...not happily... infact I'll whine and complain,  
but it would be worth it if I could cut my CPU usage in half or better.]

Thanks



More information about the Python-win32 mailing list