Closed
Description
hi there -
This is indirect from SQLAlchemy where we use greenlet for our asyncio implementation, reported in sqlalchemy/sqlalchemy#8763.
The below script creates a greenlet and calls one switch. Running on linux under any Python 3.11 version with greenlet installed from pypi (greenlet-2.0.0.post0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
), the script below grows by about 10M per second. Under Python 3.10, memory is flat at about 10 megs resident.
import greenlet
import time
def greenlet_spawn(fn, *args, **kwargs):
context = greenlet.greenlet(fn, greenlet.getcurrent())
result = context.switch(*args, **kwargs)
return result
def hi():
time.sleep(.001)
return "hello"
def go():
while True:
print(greenlet_spawn(hi))
go()
Metadata
Metadata
Assignees
Labels
No labels