1 Jul 01:32
"import numpy" is slow
Andrew Dalke <dalke <at> dalkescientific.com>
2008-06-30 23:32:02 GMT
2008-06-30 23:32:02 GMT
(Trying again now that I'm subscribed. BTW, there's no link to the subscription page from numpy.scipy.org .) The initial 'import numpy' loads a huge number of modules, even when I don't need them. Python 2.5 (r25:51918, Sep 19 2006, 08:49:13) [GCC 4.0.1 (Apple Computer, Inc. build 5341)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> import sys >>> len(sys.modules) 28 >>> import numpy >>> len(sys.modules) 256 >>> len([s for s in sorted(sys.modules) if 'numpy' in s]) 127 >>> numpy.__version__ '1.1.0' >>> As a result, I assume that's the reason my program's startup cost is quite high. [josiah:~/src/fp] dalke% time python -c 'a=4' 0.014u 0.038s 0:00.05 80.0% 0+0k 0+1io 0pf+0w [josiah:~/src/fp] dalke% time python -c 'import numpy' 0.161u 0.279s 0:00.44 97.7% 0+0k 0+9io 0pf+0w My total runtime is something like 1.4 seconds, and the only thing(Continue reading)
RSS Feed