def recursive_a(n): if not n: return burn_cpu(0.1) burn_io_gevent(0.1) g = self.spawn_greenlet("rec", recursive_a, n - 1) return g.get()
def a(n): burn_cpu(0.1) burn_io_gevent(0.1) if (n == 0): raise Exception a(n - 1)
def a(n): if (n <= 0): return burn_io_gevent(0.001) burn_cpu(0.1) a(n - 1) a(n - 2)
def a(n): if n <= 0: return burn_io_gevent(0.1) burn_cpu(0.1) g1 = self.spawn_greenlet("a_%d" % (n - 1), a, n - 1) g1.get() g2 = self.spawn_greenlet("a_%d" % (n - 2), a, n - 2) g2.get()
def common(): for _ in range(100): burn_io_gevent(0.001) burn_io(0.1) burn_cpu(0.2) for _ in range(100): burn_io_gevent(0.001) burn_io(0.1) burn_cpu(0.2)
def a(): burn_io_gevent(0.1) burn_io(0.1) burn_io_gevent(0.1) burn_io(0.1) burn_io_gevent(0.1) burn_cpu(0.3)
def a(): burn_io_gevent(0.3) burn_cpu(0.4)
def a_inner_3(): burn_cpu(0.1) burn_io_gevent(0.1)