These performance improvement tips are from Marcelo Trylesinski, the maintainer of FastAPI. These insights are shared in a LinkedIn post, which you can find here
10 tips for performances improvement :
- use uvloop +10%🚀, is a fast, drop-in replacement of the built-in asyncio event loop
- use httptools - faster parsing +10%🚀, Python binding for nodejs HTTP parser, you just need to have it installed in your environment
- use bigger threadpool +5%🚀
- use simple async application, +15%🚀, no overhead of threads
- remove duplicate validation, have only FastAPI do the validation +25%🚀
- use ORJSON + 5% 🚀(if not using the latest Pydanctic version already)
- consider running without validation is an option, 150%, without logging +25%. Both not a general recommendation!
- use the most recent version of FastAPI, + 265% 🚀- this is related to pydantic going rust
- use ASGI Middleware: see https://lnkd.in/eUW5-bwG
- compress responses
Stay tuned for the recording of the conference, which will be released on the EuroPython channel in a few weeks, allowing us to dive deeper into these performance-boosting techniques. Happy optimizing!
These performance improvement tips are from Marcelo Trylesinski, the maintainer of FastAPI. These insights are shared in a LinkedIn post, which you can find here
10 tips for performances improvement :
Stay tuned for the recording of the conference, which will be released on the EuroPython channel in a few weeks, allowing us to dive deeper into these performance-boosting techniques. Happy optimizing!