Runloom
Go-style stackful coroutines for Python. Write blocking code — fiber(fn) , plain recv / send , no async / await — and run a million of them across every core in one process. Hand-rolled asm context switch + C work-stealing scheduler + netpoll, built for free-threaded Python 3.14t (GIL off).
import threading , runloom from urllib . request import urlopen runloom . monkey . patch () def crawl ( url ): # urlopen() looks blocking -- but monkey.patch() parks the goroutine on the # socket instead of the OS thread, so all 64 fetches overlap on real cores. body = urlopen ( url , timeout = 10 ). read () print ( threading . get_native_id (), len ( body )) def main (): for _ in range ( 64 ): runloom . fiber ( crawl , "http://example.com" ) runloom . run ( 8 , main ) # 8 hub threads -> real cores on 3.14t (GIL off)
Runloom vs Go
Same box (64c, free-threaded CPython 3.13t), 8 hubs / GOMAXPROCS=8 , warm steady-state. Go ≈ 2.1 M spawn/s here.
metric runloom Go verdict spawn — pure C ( c_entry ) 2.29 M/s 2.10 M/s beats Go spawn — Python ( runloom.fiber ) 1.35 M/s 2.10 M/s 0.65× context switch ~75 ns yield · ~560 ns chan RT ~50 ns Gosched ~parity conn/s — churn (new conn per req) ~75–78 k/s ~75–78 k/s parity req/s — keep-alive echo, Python handler 596 k/s 603 k/s 0.99× — parity (C handler beats Go) memory — empty parked fiber 8.8 KB 2.7 KB 3.3× (the one real gap)
The short story: on spawn, scheduling, and throughput, runloom trades blows with Go and beats it on raw spawn — a stackful coroutine runtime on CPython matching a compiled language even with a Python handler (596 k vs 603 k req/s at saturation; a C handler beats Go). The one honest gap left is memory: a suspended fiber carries a CPython eval frame, ~3.3× Go's per-fiber RSS. Full cross-runtime numbers + cold spawn-vs-N curves: benchmark report · perf summary.
runloom . optimize ( "throughput" ) # runloom.fiber -> max spawn rate (fiber_fast) runloom . optimize ( "memory" ) # runloom.fiber -> small right-sized stacks (default)
Install
pip install runloom
... continue reading