Replies: 5 comments 1 reply
-
Fastapi makes heavy use of anyio to handle synchronization functions, but there is a performance overhead with anyio, check out the:agronholm/anyio#543 |
Beta Was this translation helpful? Give feedback.
-
Json serialization comparison:https://www.libhunt.com/compare-orjson-vs-msgspec msgspec docs: https://jcristharif.com/msgspec/benchmarks.html |
Beta Was this translation helpful? Give feedback.
-
If you want to avoid pydantic as much as possible and have full performance, you need to completely rewrite the Route class, which is destructive (not recommended). |
Beta Was this translation helpful? Give feedback.
-
Performance optimization: #382 |
Beta Was this translation helpful? Give feedback.
-
related: pydantic/pydantic#6388 |
Beta Was this translation helpful? Give feedback.
-
After reviewing the fastapi-0.108.0 source code
I have the following points:
How to improve performance?
What we've done so far:
Use jsonable_encoder to parse the response in advance, and then have fastapi to handle the content.
TODO:
Obviously, we need to change this. The reason we use a custom ResponseBase is to unify the return structure and simplify the serialization configuration;
Prompt but not implemented
Beta Was this translation helpful? Give feedback.
All reactions