• Jason Madden's avatar
    Compile gevent.queue and gevent.hub.waiter with Cython · 99541fd6
    Jason Madden authored
    This gives massive performance benefits to queues:
    
    | Benchmark                              | 27_queue_master | 27_queue_cython2             |
    |----------------------------------------|-----------------|------------------------------|
    | bench_unbounded_queue_noblock          | 2.09 us         | 622 ns: 3.37x faster (-70%)  |
    | bench_bounded_queue_noblock            | 2.55 us         | 634 ns: 4.02x faster (-75%)  |
    | bench_bounded_queue_block              | 36.1 us         | 7.29 us: 4.95x faster (-80%) |
    | bench_channel                          | 15.4 us         | 6.40 us: 2.40x faster (-58%) |
    | bench_bounded_queue_block_hub          | 13.6 us         | 3.89 us: 3.48x faster (-71%) |
    | bench_channel_hub                      | 7.55 us         | 3.38 us: 2.24x faster (-55%) |
    | bench_unbounded_priority_queue_noblock | 5.02 us         | 3.18 us: 1.58x faster (-37%) |
    | bench_bounded_priority_queue_noblock   | 5.48 us         | 3.22 us: 1.70x faster (-41%) |
    
    In a "real" use caes (pool.imap) it shows up as a 10-20% improvement:
    
    | Benchmark          | 36_pool_event5 | 36_pool_ubq_cython          |
    |--------------------|----------------|-----------------------------|
    | imap_unordered_seq | 553 us         | 461 us: 1.20x faster (-17%) |
    | imap_unordered_par | 301 us         | 265 us: 1.14x faster (-12%) |
    | imap_seq           | 587 us         | 497 us: 1.18x faster (-15%) |
    | imap_par           | 326 us         | 275 us: 1.19x faster (-16%) |
    | spawn              | 310 us         | 284 us: 1.09x faster (-8%)  |
    
    Not significant (3): map_seq; map_par; apply
    99541fd6
To find the state of this project's repository at the time of any of these versions, check out the tags.
CHANGES.rst 127 KB