litestar-org / litestar

Production-ready, Light, Flexible and Extensible ASGI API framework | Effortlessly Build Performant APIs
https://litestar.dev/
MIT License
5.34k stars 361 forks source link

Enhancement: Improve startup time #1214

Closed Goldziher closed 1 year ago

Goldziher commented 1 year ago

According to @provinzkraut:

Tthe time it takes to import starlite is exorbitant compared to other libraries.
starlette: 0.064s
fastapi: 0.4s
flask: 0.2s
sanic: 0.2s
django: 0.07
sqlalchemy: 0.19s
pandas: 0.3s
starlite: 1s 

The goal of this issue is to ensure our startup time is at least as fast as the fastapi, with the aim of being significantly faster.

provinzkraut commented 1 year ago

To add some context: This is a very naive measurement done by running time python -m "import <library>", which is not necessarily representative of starting up an entire application, but indicative of the issue at play.