reillytilbury / coppafish

Python version of iss software
MIT License
4 stars 2 forks source link

Slow import #354

Closed paulshuker closed 1 month ago

paulshuker commented 1 month ago

Running

import coppafish

is slow relative to many packages (including large ones like pytorch). This needs to be profiled and sped up. I suspect there could be some considerably large computation being accidentally computed when python is going through the package structure and running the __init__.py files. If not, then this may be unavoidable.

paulshuker commented 1 month ago

Some minor time sinks found were the use of plt.style.use("...") outside of functions and classes. These are now placed into plotting classes/functions instead. However, not much better can be done to reduce import time further unless some packages can be removed from the environment. The slow packages in order from most to least impactful (not including default packages): pytorch, fontTools (required by matplotlib), scipy, threadpoolctl, dask/utils, napari/utils/events, functools, matplotlib, importlib_metadata, typing_extensions, networkx. Removing of packages is another issue altogether so this issue gets closed.