Michael Droettboom wrote:
> All of those calls to "open" are being generated from the pytz import -- 
> which is why pytz seems like the likely candidate.  Is it possible you 
> have pytz installed as a compressed egg, or on a remote disk, or 
> something that may be causing a file reading penalty?

Mike,

The pytz import time, at nearly 1/3 of the total mpl import time, is 
crazy even on linux, given that it adds only a tiny bit of 
functionality, and as far as I can see, even that is only rarely used.

Therefore I have committed a change so that it is imported only if and 
when it is required.  Our examples still work, after I modified one that 
was trying to import timezone from mpl.dates (although it was not 
actually using timezone).  This probably illustrates the way in which 
this change may break some user code: user programs requiring 
pytz.timezone and pytz.tzinfo will have to import them directly instead 
of getting them from mpl.dates.  I hope this is acceptable; importing 
them from mpl.dates seems like bad practice anyway, since mpl.dates was 
not using them or modifying them but was just passing them on from pytz.

I suspect pytz could be redesigned so that it would not be so 
horrendously slow to import, but I am not going to tackle that.

After the change:

efir...@manini:~$ time python -c "import pylab"

real    0m0.441s
user    0m0.372s
sys     0m0.064s

Before the change:

efir...@manini:~$ time python -c "import pylab"

real    0m0.626s
user    0m0.480s
sys    0m0.124s

Again, this is recent linux on a 3-year-old laptop.

Eric

> 
> As Eric said, make sure you time the "import pytz" in a clean Python 
> session -- if a module is already imported in the Python interpreter, it 
> won't be reimported.
> 
> Mike
> 
>

------------------------------------------------------------------------------
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to