Let's see, how long does it currently take to import Menpo?
%%time
import menpo
CPU times: user 320 ms, sys: 64.2 ms, total: 384 ms Wall time: 401 ms
Can't get around importing numpy. How long does that take?
%%time
import numpy
CPU times: user 43 ms, sys: 17.3 ms, total: 60.3 ms Wall time: 58 ms
Timing's below are with numpy already imported - we just have to pay that toll.
%%time
import menpo
CPU times: user 290 ms, sys: 50.9 ms, total: 340 ms Wall time: 357 ms
That makes sense - roughly 50ms comes off the time if you pre-import numpy. Let's hunt for other expensive imports...
%%time
from skimage.transform import pyramid_gaussian
from skimage.transform.pyramids import _smooth
CPU times: user 141 ms, sys: 31.5 ms, total: 173 ms Wall time: 173 ms
%%time
from scipy.stats import multivariate_normal
from scipy.linalg import norm
from scipy.ndimage import map_coordinates
from scipy.ndimage import binary_erosion
from scipy.linalg.blas import dgemm
from scipy import optimize
from scipy.spatial import Delaunay
from scipy.spatial.distance import cdist
CPU times: user 120 ms, sys: 21 ms, total: 141 ms Wall time: 139 ms
%%time
import cyassimp
CPU times: user 47.4 ms, sys: 2.07 ms, total: 49.4 ms Wall time: 49.4 ms
%%time
from vrml.vrml97.parser import buildParser as buildVRML97Parser
import vrml.vrml97.basenodes as basenodes
from vrml.node import NullNode
CPU times: user 14.9 ms, sys: 5.9 ms, total: 20.8 ms Wall time: 20 ms
%%time
import cyrasterize
CPU times: user 4.63 ms, sys: 2.5 ms, total: 7.13 ms Wall time: 7.14 ms
%%time
import PIL.Image as PILImage
CPU times: user 1.07 ms, sys: 1.27 ms, total: 2.33 ms Wall time: 2.32 ms
%%time
import scipy
CPU times: user 1.12 ms, sys: 898 µs, total: 2.02 ms Wall time: 1.92 ms
Menpo after all above...
# pre-import all these things...
import numpy
import scipy
import cyassimp
import cyrasterize
from vrml.vrml97.parser import buildParser as buildVRML97Parser
import vrml.vrml97.basenodes as basenodes
from vrml.node import NullNode
import PIL.Image as PILImage
from skimage.transform import pyramid_gaussian
from skimage.transform.pyramids import _smooth
from scipy.stats import multivariate_normal
from scipy.linalg import norm
from scipy.ndimage import map_coordinates
from scipy.ndimage import binary_erosion
from scipy.linalg.blas import dgemm
from scipy import optimize
from scipy.spatial import Delaunay
from scipy.spatial.distance import cdist
%%time
import menpo
CPU times: user 28.9 ms, sys: 11.8 ms, total: 40.7 ms Wall time: 60.4 ms