Making Sanic Even Faster
summary
Sanic 21.3 rebuilds routing and response plumbing: it generates an AST-like route tree at startup, emits compiled runtime code via compile/exec to avoid regex loops, and narrows static vs dynamic routing latency (routing cost roughly halved in benchmarks). Streaming responses unify text/html/stream handling so callbacks disappear and HTTP/2 becomes feasible, signals replace middleware/listeners for background dispatch, a connection context object carries per-connection state, and end-to-end benchmarks show peaks around 121k req/s.
AI-written summary · about
