Threaded GUI slowing method execution?

sturlamolden sturlamolden at yahoo.no
Sat Oct 3 00:33:08 CEST 2009


On 2 Okt, 22:29, Aaron Hoover <ahoo... at EECS.Berkeley.EDU> wrote:

> My external hardware is actually sending 2000 packets per second right  
> now (but that can also be changed). Each packet currently contains 6  
> bytes of data and 6 bytes of overhead. So, 12 bytes per packet * 2000  
> packets per second is 24k bytes per second.


> Maybe I am barking up the wrong tree with Python from a speed  
> perspective, but it's just some much faster and more fun to write than  
> anything else...

I have processed data in "real time" with Python from a system that
delivered data from 64 channels at 48 kHz, 2 bytes per sample, video
tracker, I/O ports, etc. Each package was 432 bytes and arrived at 16
kHz, that is 6.59 MiB per second. Python is much faster than you
think. You just have to do some buffering. :-)

If your hardware does not provide sufficient buffering, I'd write a
small C function that takes care of this. This would be a function
that collects data as it comes in, writes to a queue, and waits for
more. Run this C function from a background Python thread using
ctypes.CDLL.

















More information about the Python-list mailing list