Should unit tests run faster with a gevent patched codebase?
Question: We’re investigating gevent as a drop in performance enhancer for our Flask
API. There is a lot of communication over psycopg2 and Redis in our codebase.
We thought we’d try running the test suite with and without:

    
    
    import gevent.monkey
    gevent.monkey.patch_all()
    import psycogreen.gevent
    psycogreen.gevent.patch_psycopg()
    

My understanding is that `patch_all()` makes many blocking calls in the
standard library more efficient on the whole by letting other threads perform
work while waiting for the return call.

Our unit tests take about 160 seconds to run in total and the difference
between gevent patched and non-patched was negligible. Should we be seeing the
power of gevent in our test suite, or does it only reveal itself in a real
life production environment?

More info: Using py.test running pretty regular python-2.7.2 unittest. Gevent
1.0rc2.


Answer: Your understanding is correct, but are you running the tests in parallel?
Perhaps [using nose](http://stackoverflow.com/questions/4710142/can-pythons-
unittest-test-in-parallel-like-nose-can)? My understanding is that gevent wont
really improve the 'straight line speed' of any linear code path, its a
mechanism to enable concurrency in a single process.

