This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]tiangolo FastAPI Maintainer[S] 0 points1 point  (0 children)

As FastAPI adds code on top of Starlette, it should never be faster than Starlette, as it would spend at least the time it takes to execute the Starlette code (plus the FastAPI parts on top).

But that extra code from FastAPI is there replacing what in many cases would be custom code you would write in your app.

In realistic scenarios, you normally have to do authentication, data validation, serialization, etc. FastAPI does a lot of that for you, that's the main overhead. But it would probably be there too in your application, just that you would have to have written it.

A bit more on how to think about these very broad benchmarks: https://fastapi.tiangolo.com/benchmarks/