tjfulle / matmodlab

Generalized material model driver
9 stars 4 forks source link

Excessive import times #6

Closed sswan closed 9 years ago

sswan commented 9 years ago

It seems there are problems with importing matplotlib taking an excessively long time (11 seconds on a computer with an SSD!!!). This is true for me when using Anaconda. Here's an example:

$ time python -c "import matmodlab" WARNING:root:fortran mmlabpack.so not found, using python backup run the build script to create mmlabpack.so WARNING:root:python backup is significantly slower

real 0m11.087s user 0m10.652s sys 0m0.455s

A very simple fix is to comment out the line "from fittings import *" in matmodlab/init.py.

This kind of highlights the problem of namespace bloat and the fact that we seem to be importing everything on init, even stuff that isn't needed.

I'm not really sure what's going on with the fittings module, but I doubt it needs to be loaded on init. Please remove that line if it doesn't ruin everything for you.

tjfulle commented 9 years ago

Moved all fitting imports to the notebook magic. I suspect that the longer import times are not as big a deal in a notebook that is designed to be open for longer periods of time.