[SciPy-dev] time to import scipy?
David Cournapeau
david at ar.media.kyoto-u.ac.jp
Tue Mar 11 22:30:45 EDT 2008
Joseph VanAndel wrote:
> When I import scipy (or just scipy.io) on a CentOS 5 64 bit computer, 4
> processor, 3.00 Ghz server, with Python 2.5.1, it takes ~10 seconds of
> elapsed time.
>
> When I'm developing and testing a Python script, I typically start the
> python interpreter dozens of times, so I concerned by how much time I
> spend waiting for the Python to startup.
>
> 1) Is there anything I can do to speed up the import of scipy?
>
Where is scipy (and its dependencies) installed ? Is it on NFS (or slow
filesystem, usb, etc...) ? If so, putting it locally could be a huge win.
10 second for scipy the first time (cold start) is not surprising: scipy
is a big package, and most time is spent on IO (reading files from the
fs). But the 2d time, a lot of this is in memory (IO buffer), so it will
be very fast. Numbers given by Ondrej suggest that it is a hot start in
his case (or that he has an extremely powerful workstation:) ).
In my case (and scipy is on NFS):
(cold start)
time python -c "import scipy"
real 0m4.007s
user 0m0.440s
sys 0m0.236s
(hot start)
time python -c "import scipy"
real 0m0.867s
user 0m0.388s
sys 0m0.212s
> 2) What debugging techniques do you suggest that avoid restarting the
> interpreter? For example, do you routinely use ipython and
> reload(my_module)
It depends on the situation. If you are debugging one script, ipython
has the %run method for that. But if you need to modify several modules
which import each other, it becomes tricky.
cheers,
David
More information about the SciPy-Dev
mailing list