[Numpy-discussion] "import numpy" performance
Fernando Perez
fperez.net at gmail.com
Mon Jul 2 17:38:39 EDT 2012
On Mon, Jul 2, 2012 at 2:26 PM, Andrew Dalke <dalke at dalkescientific.com> wrote:
>
> so the relevant timing test is more likely:
>
> % time python -c 'import numpy.core.multiarray'
> 0.086u 0.031s 0:00.12 91.6% 0+0k 0+0io 0pf+0w
No, that's the wrong thing to test, because it effectively amounts to
'import numpy', sicne the numpy __init__ file is still executed. As
David indicated, you must import multarray.so by itself.
> I do not know how to run the timing test you did, as I get:
>
> % python -c "import multiarray"
> Traceback (most recent call last):
> File "<string>", line 1, in <module>
> ImportError: No module named multi array
You just have to cd to the directory where multiarray.so lives. I get
the same numbers as David:
longs[core]> time python -c ''
real 0m0.038s
user 0m0.032s
sys 0m0.000s
longs[core]> time python -c 'import multiarray'
real 0m0.035s
user 0m0.020s
sys 0m0.012s
longs[core]> pwd
/usr/lib/python2.7/dist-packages/numpy/core
Cheers,
f
More information about the NumPy-Discussion
mailing list