On Mon, Jul 2, 2012 at 8:17 PM, Andrew Dalke <da...@dalkescientific.com> wrote: > In this email I propose a few changes which I think are minor > and which don't really affect the external NumPy API but which > I think could improve the "import numpy" performance by at > least 40%. This affects me because I and my clients use a > chemistry toolkit which uses only NumPy arrays, and where > we run short programs often on the command-line. > > > In July of 2008 I started a thread about how "import numpy" > was noticeably slow for one of my customers. They had > chemical analysis software, often even run on a single > molecular structure using command-line tools, and the > several invocations with 0.1 seconds overhead was one of > the dominant costs even when numpy wasn't needed. > > I fixed most of their problems by deferring numpy imports > until needed. I remember well the Steve Jobs anecdote at > http://folklore.org/StoryView.py?project=Macintosh&story=Saving_Lives.txt > and spent another day of my time in 2008 to identify the > parts of the numpy import sequence which seemed excessive. > I managed to get the import time down from 0.21 seconds to > 0.08 seconds.
I will answer to your other remarks later, but 0.21 sec to import numpy is very slow, especially on a recent computer. It is 0.095 sec on my mac, and 0.075 sec on a linux VM on the same computer (both hot cache of course). importing multiarray.so only is negligible for me (i.e. difference between python -c "import multiarray" and python -c "" is statistically insignificant). I would check external factors, like the size of your sys.path as well. David _______________________________________________ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion