[Numpy-discussion] slow import of numpy modules

David Cournapeau cournapeau at cslab.kecl.ntt.co.jp
Thu Jul 3 02:38:42 EDT 2008


On Thu, 2008-07-03 at 01:25 -0500, Robert Kern wrote:

> 
> Before:
> $ time python -c "import numpy"
> python -c "import numpy"  0.30s user 0.82s system 91% cpu 1.232 total
> 
> Removal of finfo:
> $ time python -c "import numpy"
> python -c "import numpy"  0.27s user 0.82s system 94% cpu 1.156 total
> 
> Removal of finfo and delayed imports:
> $ time python -c "import numpy"
> python -c "import numpy"  0.19s user 0.56s system 93% cpu 0.811 total

I don't know how much is due to the hardware and how much is due to OS
differences, but in my case (Linux with core 2 duo), with your changes,
it went from:

real    0m0.184s
user    0m0.146s
sys     0m0.034s

To

real    0m0.081s
user    0m0.056s
sys     0m0.022s

Definitely worthwhile (now, importing numpy has no noticeable latency on
a fast computer, which feels nice). Thanks for committing the changes,

David




More information about the NumPy-Discussion mailing list