pulsar
pulsar copied to clipboard
Greenlet Pool Enhancement
- pulsar version: 2.0.1
Description
The greenlet pool is used for consuming implicit asynchronous function in a pool of greenlets. The performance of consuming in the pool is worse than writing explicit asynchronous code. The reason for the worse performance is the creation of tasks to run in the greenlet pool.
To improve things we should have a task always running which consume tasks from a queue.
Steps to reproduce
python setup.py bench -a green --sequential --io uv
with results
TestGreenIo.test_green_io: repeated 10(x2000) times, average 0.29259 secs, stdev 2.81 %
TestGreenIo.test_green_pool: repeated 10(x2000) times, average 0.38892 secs, stdev 2.64 %
TestGreenIo.test_yield_io: repeated 10(x2000) times, average 0.27353 secs, stdev 1.9 %
Ran 3 tests in 9.699s