1. 22 Feb, 2018 5 commits
  2. 21 Feb, 2018 2 commits
    • Jason Madden's avatar
      Add spawn_tree_locals, spawning_greenlet and spawning_stack to Greenlet · 15fc1ecc
      Jason Madden authored
      Based on #755.
      
      A comment in the code goes into detail about the timing. Here it is
      again:
      
       Timings taken Feb 21 2018 prior to integration of #755
       python -m perf timeit -s 'import gevent' 'gevent.Greenlet()'
       3.6.4       : Mean +- std dev: 1.08 us +- 0.05 us
       2.7.14      : Mean +- std dev: 1.44 us +- 0.06 us
       PyPy2 5.10.0: Mean +- std dev: 2.14 ns +- 0.08 ns
      
       After the integration of spawning_stack, spawning_greenlet,
       and spawn_tree_locals on that same date:
       3.6.4       : Mean +- std dev: 8.92 us +- 0.36 us ->  8.2x
       2.7.14      : Mean +- std dev: 14.8 us +- 0.5 us  -> 10.2x
       PyPy2 5.10.0: Mean +- std dev: 3.24 us +- 0.17 us ->  1.5x
      
      Selected bench_spawn output on 3.6.4 before:
      
      //gevent36/bin/python src/greentest/bench_spawn.py eventlet --ignore-import-errors
      using eventlet from //gevent36/lib/python3.6/site-packages/eventlet/__init__.py
      spawning: 11.93 microseconds per greenlet
      sleep(0): 23.49 microseconds per greenlet
      
      //gevent36/bin/python src/greentest/bench_spawn.py gevent --ignore-import-errors
      using gevent from //src/gevent/__init__.py
      spawning: 3.39 microseconds per greenlet
      sleep(0): 17.59 microseconds per greenlet
      
      //gevent36/bin/python src/greentest/bench_spawn.py geventpool --ignore-import-errors
      using gevent from //src/gevent/__init__.py
      spawning: 8.71 microseconds per greenlet
      
      //gevent36/bin/python src/greentest/bench_spawn.py geventraw --ignore-import-errors
      using gevent from //src/gevent/__init__.py
      spawning: 2.09 microseconds per greenlet
      
      //gevent36/bin/python src/greentest/bench_spawn.py none --ignore-import-errors
          noop: 0.33 microseconds per greenlet
      
      And after:
      
      //gevent36/bin/python bench_spawn.py gevent --ignore-import-errors
      using gevent from //src/gevent/__init__.py
      spawning: 12.99 microseconds per greenlet -> 3.8x
      
      //gevent36/bin/python bench_spawn.py geventpool --ignore-import-errors
      using gevent from //src/gevent/__init__.py
      spawning: 19.49 microseconds per greenlet -> 2.2x
      
      //gevent36/bin/python bench_spawn.py geventraw --ignore-import-errors
      using gevent from //src/gevent/__init__.py
      spawning: 4.57 microseconds per greenlet -> 2.2x
      
      We're approximately the speed of eventlet now.
      
      Refs #755
      15fc1ecc
    • Jason Madden's avatar
      Update bench_spawn · 54ffea34
      Jason Madden authored
      Current numbers on my workstation:
      
      CPython 3.6.4
      
      //gevent36/bin/python bench_spawn.py eventlet --ignore-import-errors
      using eventlet from //python3.6/site-packages/eventlet/__init__.py
      spawning: 11.93 microseconds per greenlet
      sleep(0): 23.49 microseconds per greenlet
      
      //gevent36/bin/python bench_spawn.py gevent --ignore-import-errors
      using gevent from //src/gevent/__init__.py
      spawning: 3.39 microseconds per greenlet
      sleep(0): 17.59 microseconds per greenlet
      
      //gevent36/bin/python bench_spawn.py geventpool --ignore-import-errors
      using gevent from //src/gevent/__init__.py
      spawning: 8.71 microseconds per greenlet
      sleep(0): 16.99 microseconds per greenlet
       joining: 7.34 microseconds per greenlet
      
      //gevent36/bin/python bench_spawn.py geventraw --ignore-import-errors
      using gevent from //src/gevent/__init__.py
      spawning: 2.09 microseconds per greenlet
      sleep(0): 13.57 microseconds per greenlet
      
      //gevent36/bin/python bench_spawn.py none --ignore-import-errors
          noop: 0.33 microseconds per greenlet
      
      //gevent36/bin/python bench_spawn.py --with-kwargs eventlet --ignore-import-errors
      using eventlet from //python3.6/site-packages/eventlet/__init__.py
      spawning: 12.06 microseconds per greenlet
      sleep(0): 24.25 microseconds per greenlet
      
      //gevent36/bin/python bench_spawn.py --with-kwargs gevent --ignore-import-errors
      using gevent from //src/gevent/__init__.py
      spawning: 4.62 microseconds per greenlet
      sleep(0): 22.18 microseconds per greenlet
      
      //gevent36/bin/python bench_spawn.py --with-kwargs geventpool --ignore-import-errors
      using gevent from //src/gevent/__init__.py
      spawning: 10.25 microseconds per greenlet
      sleep(0): 18.89 microseconds per greenlet
       joining: 7.14 microseconds per greenlet
      
      //gevent36/bin/python bench_spawn.py --with-kwargs geventraw --ignore-import-errors
      using gevent from //src/gevent/__init__.py
      spawning: 3.27 microseconds per greenlet
      sleep(0): 15.03 microseconds per greenlet
      
      //gevent36/bin/python bench_spawn.py --with-kwargs none --ignore-import-errors
          noop: 0.50 microseconds per greenlet
      
      CPython 2.7.14
      
      //gevent27/bin/python bench_spawn.py eventlet --ignore-import-errors
      using eventlet from //python2.7/site-packages/eventlet/__init__.pyc
      spawning: 17.84 microseconds per greenlet
      sleep(0): 31.42 microseconds per greenlet
      
      //gevent27/bin/python bench_spawn.py gevent --ignore-import-errors
      using gevent from //src/gevent/__init__.pyc
      spawning: 4.95 microseconds per greenlet
      sleep(0): 21.40 microseconds per greenlet
      
      //gevent27/bin/python bench_spawn.py geventpool --ignore-import-errors
      using gevent from //src/gevent/__init__.pyc
      spawning: 12.44 microseconds per greenlet
      sleep(0): 22.90 microseconds per greenlet
       joining: 10.68 microseconds per greenlet
      
      //gevent27/bin/python bench_spawn.py geventraw --ignore-import-errors
      using gevent from //src/gevent/__init__.pyc
      spawning: 2.33 microseconds per greenlet
      sleep(0): 15.11 microseconds per greenlet
      
      //gevent27/bin/python bench_spawn.py none --ignore-import-errors
          noop: 0.58 microseconds per greenlet
      
      //gevent27/bin/python bench_spawn.py --with-kwargs eventlet --ignore-import-errors
      using eventlet from //python2.7/site-packages/eventlet/__init__.pyc
      spawning: 19.38 microseconds per greenlet
      sleep(0): 31.62 microseconds per greenlet
      
      //gevent27/bin/python bench_spawn.py --with-kwargs gevent --ignore-import-errors
      using gevent from //src/gevent/__init__.pyc
      spawning: 6.59 microseconds per greenlet
      sleep(0): 23.12 microseconds per greenlet
      
      //gevent27/bin/python bench_spawn.py --with-kwargs geventpool --ignore-import-errors
      using gevent from //src/gevent/__init__.pyc
      spawning: 13.78 microseconds per greenlet
      sleep(0): 21.65 microseconds per greenlet
       joining: 10.86 microseconds per greenlet
      
      //gevent27/bin/python bench_spawn.py --with-kwargs geventraw --ignore-import-errors
      using gevent from //src/gevent/__init__.pyc
      spawning: 3.59 microseconds per greenlet
      sleep(0): 16.14 microseconds per greenlet
      
      //gevent27/bin/python bench_spawn.py --with-kwargs none --ignore-import-errors
          noop: 0.65 microseconds per greenlet
      
      PyPy2 5.10.0
      
      //geventpypy/bin/python bench_spawn.py eventlet --ignore-import-errors
      using eventlet from //geventpypy/site-packages/eventlet/__init__.pyc
      spawning: 29.91 microseconds per greenlet
      sleep(0): 84.24 microseconds per greenlet
      
      //geventpypy/bin/python bench_spawn.py gevent --ignore-import-errors
      using gevent from //src/gevent/__init__.py
      spawning: 0.73 microseconds per greenlet
      sleep(0): 33.02 microseconds per greenlet
      
      //geventpypy/bin/python bench_spawn.py geventpool --ignore-import-errors
      using gevent from //src/gevent/__init__.pyc
      spawning: 2.49 microseconds per greenlet
      sleep(0): 38.56 microseconds per greenlet
       joining: 13.08 microseconds per greenlet
      
      //geventpypy/bin/python bench_spawn.py geventraw --ignore-import-errors
      using gevent from //src/gevent/__init__.pyc
      spawning: 0.52 microseconds per greenlet
      sleep(0): 29.63 microseconds per greenlet
      
      //geventpypy/bin/python bench_spawn.py none --ignore-import-errors
          noop: 0.02 microseconds per greenlet
      
      //geventpypy/bin/python bench_spawn.py --with-kwargs eventlet --ignore-import-errors
      using eventlet from //geventpypy/site-packages/eventlet/__init__.pyc
      spawning: 30.36 microseconds per greenlet
      sleep(0): 83.00 microseconds per greenlet
      
      //geventpypy/bin/python bench_spawn.py --with-kwargs gevent --ignore-import-errors
      using gevent from //src/gevent/__init__.pyc
      spawning: 1.56 microseconds per greenlet
      sleep(0): 34.80 microseconds per greenlet
      
      //geventpypy/bin/python bench_spawn.py --with-kwargs geventpool --ignore-import-errors
      using gevent from //src/gevent/__init__.pyc
      spawning: 3.48 microseconds per greenlet
      sleep(0): 39.43 microseconds per greenlet
       joining: 16.21 microseconds per greenlet
      
      //geventpypy/bin/python bench_spawn.py --with-kwargs geventraw --ignore-import-errors
      using gevent from //src/gevent/__init__.pyc
      spawning: 1.51 microseconds per greenlet
      sleep(0): 52.19 microseconds per greenlet
      
      //geventpypy/bin/python bench_spawn.py --with-kwargs none --ignore-import-errors
          noop: 0.13 microseconds per greenlet
      
      [skip ci]
      54ffea34
  3. 20 Feb, 2018 7 commits
  4. 19 Feb, 2018 6 commits
  5. 17 Feb, 2018 3 commits
  6. 16 Feb, 2018 6 commits
  7. 15 Feb, 2018 10 commits
  8. 14 Feb, 2018 1 commit