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
________________________________________
From: David Kremer [david.kremer...@gmail.com]
Sent: Monday, March 28, 2011 9:36 AM
To: Matplotlib Users
Subject: [Matplotlib-users] matplotlib is slow

Hello everyone,

I would like to draw the attention on the slow startup of matplotlib.

Indeed, running matplotlib takes a long time.

I performed the following sequence :

```bash
#!/bin/bash

for i in * ; do python2 -c "from temp import * ; plot_(\"${i}\") " ; done
```

with temp.py like this :

```python
#!/usr/bin/env python2

import sys
import matplotlib.pyplot as plt
import read_data as rd
import numpy


def plot_( fname ):
    P,I = rd.read_data(fname)
    Iprime = [ l / k for k , l in zip( numpy.diff(P) , numpy.diff(I) ) ]

    fig = plt.figure()
    ax1 = fig.add_subplot(211)
    ax2 = fig.add_subplot(212)

    ax1.plot(P,I)
    ax2.plot(P[:-1],Iprime)

    fig.savefig( fname + ".pdf", format='pdf' )

```
And it seems the longer operation is to import matplotlib.pyplot.

Does something could be done to improve the loading time of this module ?

Thank you very much.

greatings,

David Kremer

------------------------------------------------------------------------------
Enable your software for Intel(R) Active Management Technology to meet the
growing manageability and security demands of your customers. Businesses
are taking advantage of Intel(R) vPro (TM) technology - will your software
be a part of the solution? Download the Intel(R) Manageability Checker
today! http://p.sf.net/sfu/intel-dev2devmar
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

------------------------------------------------------------------------------
Enable your software for Intel(R) Active Management Technology to meet the
growing manageability and security demands of your customers. Businesses
are taking advantage of Intel(R) vPro (TM) technology - will your software 
be a part of the solution? Download the Intel(R) Manageability Checker 
today! http://p.sf.net/sfu/intel-dev2devmar
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to