Closed OwenPriceSkelly closed 9 months ago
All modified and coverable lines are covered by tests :white_check_mark:
Comparison is base (
0e0f698
) 76.04% compared to head (eb52ac1
) 76.04%.
:exclamation: Your organization needs to install the Codecov GitHub app to enable full functionality.
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
LGTM! If you want to save your profiling script in a side folder or something that could be cool
sure! maybe not worth adding to the repo but I copied it to a gist here
Overview
😤 Scientists HATE him 😤! see how this One Weird Trick can save you countless (~4.5) seconds whenever you
import garden_ai
** for the first time ** in a new, completely isolated virtual environment *** only noticeable on apple silicon
Discussion
Turns out that nearly all of the ~10-15s cold start delay we've noticed in our study halls can be traced to our big dependencies with C extension modules:
pydantic
, which is the majority of the slowdown but too difficult to lazy import everywhere; andnbconvert
, which was trivial to lazy import since it's only used once incontainers.py
. Pretty consistent 60/40 split in terms of total contribution to import time on my machine.Testing
I have a little profiling script that sets up a new environment, installs a package, and then profiles how long that package & its dependencies take to import with
python -X importtime -c 'import garden_ai'
. I also usedtuna
to visualize the import profiles, but I thinksnakeviz
can handle that too. Manually running stuff likepython -c 'import pydantic' && python -X importtime -c 'import garden_ai'
helped sanity check, too📚 Documentation preview 📚: https://garden-ai--390.org.readthedocs.build/en/390/