nnpdf
nnpdf copied to clipboard
Improve import times
It takes long to import code is starting to become and issue (because those few seconds are incredibly distracting). Toying around with e.g.
python -X importtime `which validphys` 2> /tmp/importtimes
I notice that some of the biggest offenders are scipy.stats (which does some expensive magic at import time), seaborn (no idea why) and validphy.version (because we are calling various subprocesses). In particular scipy.stats adds a whole second by itself.
We don't need those on most code paths, so I would suggest trying to avoid using them on top of the various files. That should be ease for scipy.stats. For the version thing, we could perhaps consider some hack like doing the computation in the __repr__.
To put things in perspective, do python -c 'import tensorflow'
But ok to all suggestions. Seaborn is only used in the hyperplot stuff so it is easy to hide away as well.