4 ms·
100x faster than FastAPI seems easy. I wonder how it compares to other fast Python libraries like Japronto[1] and non-Python ones too. 1 - https://github.com/s
by dom96 4y ago
100x faster than FastAPI seems easy. I wonder how it compares to other fast Python libraries like Japronto[1] and non-Python ones too.
1 - https://github.com/squeaky-pl/japronto https://github.com/squeaky-pl/japronto
- ashvardanian 4y agoThe difference would still be huge. It's exceptionally large even when we compare to the gRPC C++ server implementations.
- dom96 4y agoHow large? Also I'm not sure the gRPC C++ server implementations you've tested are the fastest. If you're comparing to FastAPI (which is more of an HTTP server framework) then you should also compare to what is at the top of https://www.techempower.com/benchmarks/#section=data-r21 https://www.techempower.com/benchmarks/#section=data-r21.
- neonsunset 4y agoIt's hard to beat SimdJSON + io_uring. Other implementations should provide a port of the former or equivalent/faster implementation and too rely on io_uring, with epoll being a viable competitor in limited set of scenarios. I would expect Python being also a bottleneck here with other compiled languages (besides C/C++) that have good interop and ability to write vectorized code having an upper hand like Rust, C# or Go.
- ashvardanian 4y agoYou are right! For the convenience of Python users, we have to introspect the messages and parse JSON into Python objects. Every member of every dictionary being allocated on heap. To make it as fast as possible we don't use PyBind, NanoBind, SWIG, or any high-level tooling. Our Python bindings are a pure CPython integration. There is just no way to beat that combo, not that I know. https://github.com/unum-cloud/ujrpc/blob/main/src/python.c https://github.com/unum-cloud/ujrpc/blob/main/src/python.c