4 ms·
The biggest differentiator between Robyn and frameworks like FastAPI or Sanic seems to be the Rust runtime. But is Python's async actually the bottleneck that R
by linwangg 2y ago
The biggest differentiator between Robyn and frameworks like FastAPI or Sanic seems to be the Rust runtime. But is Python's async actually the bottleneck that Rust is solving here?
- vednig 2y agoGlobal Interpreter Lock (GIL) limits how effectively multiple threads can be used in Python. Hence the event loop in Rust runtime for async makes more sense here.
- Kwpolska 2y agoThe GIL which is currently being removed from CPython?
- vednig 2y agoYeah, in newer versions
- mont_tag 2y agoAn async event loop doesn't have anything to do with the GIL or threads. Async is all about cooperative concurrency where a task yields in places that it would normally block. The tasks can all run in a single thread.
- bvrmn 2y agoActual bottleneck in examples is sqlalchemy, like 10x overhead easily. I find it quite funny. There is no real difference in web frameworks for real apps in terms of overhead.
- michaelcampbell 2y agoI've often wondered about this; are there studies/tests to this effect anywhere that you can link?
- bvrmn 2y agoReturning static "hello world" response for slowest python framework is easily not bigger than 1ms (for fast frameworks it's 0.1ms or lower). Good luck to make the rest of your app to make something comparably fast if db or network is involved.
- rybosome 2y agoI hear this sort of thinking repeated often, and it makes sense at an intuitive level. However, my experience is that this isn’t always the case. My company has a medium-large Python web app in production, and having viewed performance profiles, I can say definitively that Python code execution occupies a non-trivial amount of processing time. Of course the single largest time sink is the LLM requests we make, but if we could magically nullify the Python processing time, our latency would significantly improve. The culprit in this case may be specific to FastAPI and Pydantic rather than Python generally, but the point still holds that not all web frameworks and resultant apps are equivalent. That said, I’ve been dreaming of rewriting large chunks of it in golang. I’ve always known Python was relatively slower than other languages, but I saw a recent benchmark measuring golang as 50x faster than Python. Perhaps the benchmark won’t translate to real world performance, but still - 50x is difficult to ignore.
- odie5533 2y agoThere are wider performance gaps between Python-based frameworks and things like using Rust+Axum or Go.