-
Notifications
You must be signed in to change notification settings - Fork 2.1k
chore: Reduce runserver import time by 75% from 30s to 8s #41847
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
15 files reviewed, 3 comments
95eb496 to
d2b15c9
Compare
| "serialize_fields", | ||
| "HOGQL_CHARACTERS_TO_BE_WRAPPED", | ||
| ): | ||
| _load_database_module() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This might add time to hogql queries? Just reading code here I have no idea what the actual time difference is and if it's meaningful but the hogql query execution path is definitely a place where we want to shave every bit of slowness off of
Problem
we import a bunch of heavy packages on startup. do some clever lazy loading to avoid this!
Changes
Before:

After:

The vast majority now is schema.py, wait for something clever there too!
How did you test this code?
👉 Stay up-to-date with PostHog coding conventions for a smoother review.
Changelog: (features only) Is this feature complete?