I acquire samples (integers) at a very high rate (several kilo samples per seconds) in a thread and put()
them in a threading.Queue
. The main thread get()
s the samples one by one into a list of length 4096, then msgpack
s them and finally sends them via ZeroMQ to a client. The client shows the chunks on the screen (print or plot). In short the original idea is, fill the queue with single samples, but empty it in large chunks.
Everything works 100% as expected. But the latter part i.e. accessing the queue is very very slow. Queue gets larger and the output always lags behind by several to tens of seconds.
My question is: how can I do something to make queue access faster? Is there a better approach?