So I've been testing the performance a bit, varying e.g.
- 1:1, 16:1, 64:1 producer : consumer ratio
- normal/lifo/priority queue etc
- asyncio/uvloop event loop
- async -> async, async -> sync, sync -> sync
- (probably more)
I found that, janus queues are ~5x slower in sync->sync, ~9x slower in sync->async, and ~15x slower in async->async. This is pretty much consistent across all parameter sets.
This confirmed my suspicion that the performance gain of parallel computation is often less than the cost of using e.g. threading.Lock a lot (the GIL certainly doesn't help either).
Right now, I can imagine that many users have incorrect expectations of janus. To avoid this, you could add an example that shows how janus can outperform single-threaded asyncio, by employing multiple threads. Additionally, a caveat about janus' performance would be helpful.
So I've been testing the performance a bit, varying e.g.
I found that, janus queues are ~5x slower in sync->sync, ~9x slower in sync->async, and ~15x slower in async->async. This is pretty much consistent across all parameter sets.
This confirmed my suspicion that the performance gain of parallel computation is often less than the cost of using e.g.
threading.Locka lot (the GIL certainly doesn't help either).Right now, I can imagine that many users have incorrect expectations of janus. To avoid this, you could add an example that shows how janus can outperform single-threaded asyncio, by employing multiple threads. Additionally, a caveat about janus' performance would be helpful.