From: David K. <da...@da...> - 2011-03-29 19:43:56
|
> I would recommend running the import in the Python profiler to determine > where most of the time is going. When I investigated this a few years > back, it was mainly due to loading the GUI toolkits, which are > understandably quite large. You can avoid most of that by using the Agg > backend. If you're using the Agg backend and still experiencing > slowness, it may be that load-up issues have crept back into matplotlib > since then -- but we need profiling data to figure out where and how. > > Mike Thank you a lot for your answer. I noticed than _matplotlib.pyplot_ is longer to be imported the first time than if it has already been imported previously (maybe things are already loaded in ram memory), and we don't need to fetch it from the hard drive thanks to the kernel. As far I see, the function calls are the same for the two logs I obtained, except than the first took 6s instead of 1.4s. The two logs have been obtained using : <code> python -m cProfile temp.py </code> where temp.py consist of two lines : <code> #!/usr/bin/env python2 import matplotlib.pyplot </code> |