[Tutor] Speeding up import time

Danny Yoo dyoo@hkn.eecs.berkeley.edu
Mon Apr 21 02:01:03 2003


On Sat, 19 Apr 2003, Tony Cappellini wrote:

>
>
> I'm loading the io module, from scipy in one of my programs, as in
>
> from scipy import io
>
> This particular module takes 3-5 seconds to load on some of the slower
> systems that I use.
> Is there anything i can do to improve this import time ?

Hi Tony,

You may want to chat with the Scientific Python folks about this actually;
module importing should probably not take that long, especially if the
module has been precompiled into bytecode (as it should be).

Also, module importing should be a one-time thing, so as long as you don't
have to keep spawning up new instances of Python, you should be ok, as
you'll only incur the importing cost once.


Now that I looked at it, I see that a lot of the code in scipy looks like
C extension modules... I'd definitely ask on the scipy lists for this one;
perhaps 'weave' or one of the other modules in scipy has a long startup
time?  I don't think there's anything casual we can do as users to speed
up the import of a C extension module, so we need to chat with the scipy
developers for this one.


For your convenience, here's a link to the scipy mailing lists:

    http://www.scipy.org/site_content/MailList


I hope that you can find the answers you're looking for.  Good luck!