[Matplotlib-devel] import time doubled by master vs 1.4.3

Eric Firing efiring at hawaii.edu
Tue Sep 8 22:42:15 CEST 2015


On 2015/09/08 9:51 AM, Thomas Caswell wrote:
> My guess is that this has to do with disk access?  With venvs running on
> a ramdisk I get almost identical times, particularly if I run it a
> couple of times:
>
> 15:39$ time python -c "from matplotlib import pyplot; import matplotlib;
> print(matplotlib.__version__)"
> 1.4.3
>
> real    0m0.377s
> user    0m0.343s
> sys     0m0.030s
>
> 15:36$ time python -c "from matplotlib import pyplot; import matplotlib;
> print(matplotlib.__version__)"
> 1.5.dev1
>
> real    0m0.362s
> user    0m0.327s
> sys     0m0.030s
>
> Both of those times fluctuate and despite what I pasted, 1.4.3 seems to
> be faster more often than not (but by hundredths of seconds).
>
> Running this command several times seems the later runs seem to be
> faster than the first time.

Running multiple times one does see variations, but not large ones 
compared to the factor of two I am getting between the versions.  My 
environment is a virtualenv in a VMWare linux VM on a Mac, with the disk 
access via VMWare's hgfs.  The Mac has SSD, so the physical disk access 
is quick; and at least some things will be retrieved from cache on 
multiple runs. The tests were made using the same VM and the same 
virtualenv, so the only thing that changed was whether I had just build 
mpl from 1.4.3 or from master.

Now I have tried the experiment on the OSX side, and I get very similar 
results, except that all the times are a little bit longer than on the 
linux VM:


(python3)efiring at manini2:~/work/programs/py/ladcp_netcdf$ time python -c 
"from matplotlib import pyplot; import matplotlib; 
print(matplotlib.__version__)"
1.4.3

real	0m0.379s
user	0m0.321s
sys	0m0.055s

(testmpl3)efiring at manini2:~/work/programs/py/mpl/matplotlib$ time python 
-c "from matplotlib import pyplot; import matplotlib; 
print(matplotlib.__version__)"
1.5.dev1

real	0m0.795s
user	0m0.704s
sys	0m0.086s

I guess the fact that the linux VM on OSX is faster than native OSX 
points to disk access in some form--maybe there is more caching on the 
linux side--but the puzzle remains: why the factor of two difference 
between 1.4.3 and master in these two reasonably normal configurations?

Eric


>
> Tom
>
> On Tue, Sep 8, 2015 at 3:30 PM Eric Firing <efiring at hawaii.edu
> <mailto:efiring at hawaii.edu>> wrote:
>
>     test:
>
>     time python -c "from matplotlib import pyplot"
>
>     On a linux VM with Py 3.4 the user time is around
>
>     0.25 s for 1.4.3
>     0.5 s for master
>
>     That's quite a difference.  Can anyone else reproduce this?  Any ideas
>     as to what is causing the slowdown?
>
>     In both tests the backend was tkagg, so the difference was not a matter
>     of importing different gui toolkits.
>
>     Eric
>     _______________________________________________
>     Matplotlib-devel mailing list
>     Matplotlib-devel at python.org <mailto:Matplotlib-devel at python.org>
>     https://mail.python.org/mailman/listinfo/matplotlib-devel
>



More information about the Matplotlib-devel mailing list