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

Nathaniel Smith njs at pobox.com
Tue Sep 8 23:01:10 CEST 2015

On Sep 8, 2015 1:53 PM, "Eric Firing" <efiring at hawaii.edu> wrote:
> 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:
> I ran
> strace python -c "from matplotlib import pyplot" > ../tests/master.trace
> and similar for v1.4.3:
> -rw-r--r-- 1 efiring efiring   448374 Sep  8 10:46 v143.trace
> -rw-r--r-- 1 efiring efiring   774942 Sep  8 10:49 master.trace
> (python3)efiring at manini4:~/work/programs/py/mpl/tests$ grep matplotlib
master.trace | wc
>     899    4988  127344
> (python3)efiring at manini4:~/work/programs/py/mpl/tests$ grep matplotlib
v143.trace | wc
>     693    3890   99963
> (python3)efiring at manini4:~/work/programs/py/mpl/tests$ grep stat
master.trace | wc
>    4307   27785  463042
> (python3)efiring at manini4:~/work/programs/py/mpl/tests$ grep stat
v143.trace | wc
>    2381   14898  248260
> Somehow, master seems to have nearly doubled the number of stat calls.
Maybe there is more circularity in the imports now?

Do you have the same number of entries on sys.path for the two
interpreters? Most stat calls at import are checking to see which directory
in sys.path has the requested items.

Do you have any reason to believe that stat calls are actually what's
taking time? The calls themselves should show up in system time, which is
not very different in your quoted numbers -- though there could be some
python level overhead for processing each stat call depending on what
you're doing (which would show up in user time). You can also use the -T
options to strace to record timing information (though of course it also
slows things down). But generally strace is not a great tool for
investigating user cpu time differences, because it only watches
user<->system transitions.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/matplotlib-devel/attachments/20150908/4983505f/attachment.html>

More information about the Matplotlib-devel mailing list