Maxim Sakhno @maxim-sakhno.bsky.social · 28/01/2026The logic behind the batches: Kahn’s algorithm for topological sorting. 🧠 LiteStar's implementation: dub.sh/0DG8van LiteStar uses it to identify which dependencies can run in parallel and groups them into batches. The algorithm visualization 👇 110
Maxim Sakhno @maxim-sakhno.bsky.social · 28/01/2026Why use Kahn's algorithm? 🤔 It doesn't just sequence dependencies; it finds batches that can run in parallel. For heavy I/O tasks, this is a massive win. The speedup from concurrency easily outweighs the TaskGroup overhead. 110
Maxim Sakhno @maxim-sakhno.bsky.social · 28/01/2026But wait... didn't LiteStar beat FastAPI in their own benchmarks? Ah, they used nested dependencies only! That explains it. 💡 110