Has anyone had any success in speeding up the mpl imports?
“import matplotlib.pyplot as plt”
( or “from matplotlib.figure import Figure”)
takes 6 full seconds to load. That seems excessive. Any ideas?
-Andy
Has anyone had any success in speeding up the mpl imports?
“import matplotlib.pyplot as plt”
( or “from matplotlib.figure import Figure”)
takes 6 full seconds to load. That seems excessive. Any ideas?
-Andy
Hmm, I wrote one time a lazy-import module, you create objects and use
their attributes, but the object imports the module not earlier than
the first attribute access. Thus these objects are used like the
module via "import module". I.e., module = Lazy('matplotlib.module').
There are also wrappers for classes for replacement of "from moudule
import Class" syntax. Is anybody interested, anyway?
Friedrich
Andrew Kelly wrote:
Has anyone had any success in speeding up the mpl imports?
"import matplotlib.pyplot as plt" ( or "from matplotlib.figure import Figure")
takes 6 full seconds to load. That seems excessive. Any ideas?
Unless you have a very old machine, it sounds like something is wrong.
On my laptop it is about 0.6 seconds. About 20% of that is for numpy.
Are mpl and numpy installed locally on your machine, as opposed to being accessed over a samba or nfs mount?
Eric
-Andy
Andrew Kelly wrote:
Has anyone had any success in speeding up the mpl imports?
"import matplotlib.pyplot as plt" ( or "from matplotlib.figure import Figure")
takes 6 full seconds to load. That seems excessive. Any ideas?
-Andy
Andy,
A couple replies came back directly to me (probably intended for the list, though), and both reported results similar to yours, on Windows machines only. What OS and version are you running?
Eric
Eric,
I am running it on a windows 7 machine and a windows XP machine. Odd that it does this only on win32.
-Andy
On Thu, Apr 1, 2010 at 4:17 PM, Eric Firing <efiring@…202…> wrote:
Andrew Kelly wrote:
Has anyone had any success in speeding up the mpl imports?
“import matplotlib.pyplot as plt” ( or “from matplotlib.figure import Figure”)
takes 6 full seconds to load. That seems excessive. Any ideas?
-Andy
Andy,
A couple replies came back directly to me (probably intended for the list, though), and both reported results similar to yours, on Windows machines only. What OS and version are you running?
Eric
Sorry Eric, that was indeed intended for the list. Just for the
list's sake, I'll repeat it:
It takes longer than any other Python module for me, too, about 5-6
seconds on a "cold" load (on Windows), though faster on a "warm" load.
I am running it locally on a laptop that is 1.7 GHz Intel Pentium
laptop with 1Meg RAM.
And I should add: I don't currently have Linux installed, but will
soon again I hope, and I will take note of how long it takes on Linux.
Thanks,
Che
On Thu, Apr 1, 2010 at 7:17 PM, Eric Firing <efiring@...202...> wrote:
Andrew Kelly wrote:
Has anyone had any success in speeding up the mpl imports?
"import matplotlib.pyplot as plt"
( or "from matplotlib.figure import Figure")takes 6 full seconds to load. That seems excessive. Any ideas?
-Andy
Andy,
A couple replies came back directly to me (probably intended for the
list, though), and both reported results similar to yours, on Windows
machines only. What OS and version are you running?
This is Intel Core 2 Duo 2.5Ghz with 4GB Ram.
On Thu, Apr 1, 2010 at 7:57 PM, C M <cmpython@…287…> wrote:
On Thu, Apr 1, 2010 at 7:17 PM, Eric Firing <efiring@…202…> wrote:
Andrew Kelly wrote:
Has anyone had any success in speeding up the mpl imports?
“import matplotlib.pyplot as plt”
( or “from matplotlib.figure import Figure”)
takes 6 full seconds to load. That seems excessive. Any ideas?
-Andy
Andy,
A couple replies came back directly to me (probably intended for the
list, though), and both reported results similar to yours, on Windows
machines only. What OS and version are you running?
Sorry Eric, that was indeed intended for the list. Just for the
list’s sake, I’ll repeat it:
It takes longer than any other Python module for me, too, about 5-6
seconds on a “cold” load (on Windows), though faster on a “warm” load.
I am running it locally on a laptop that is 1.7 GHz Intel Pentium
laptop with 1Meg RAM.
And I should add: I don’t currently have Linux installed, but will
soon again I hope, and I will take note of how long it takes on Linux.
Thanks,
Che
================================================================================
Platform : Linux-2.6.31.9-174.fc12.i686.PAE-i686-with-fedora-12-Constantine
I[2]: %time import matplotlib.pyplot as plt
CPU times: user 0.35 s, sys: 0.09 s, total: 0.43 s
Wall time: 1.18 s
My test-bed is IPython -pylab and the first load always takes longer. Probably it’s caching at the first time to speed-up later imports.
–
Gökhan
My gut says it's probably the GUI framework import that is dominating the time. Which backend are you using? Does importing it take a large amount of time as well?
Can you provide a profiler output file we can examine to narrow it down? The following from a command prompt should be sufficient to write out a file called "import.prof":
python.exe -c "import cProfile; prof=cProfile.Profile(); prof.run('import pylab', 'import.prof')"
Mike
C M wrote:
On Thu, Apr 1, 2010 at 7:17 PM, Eric Firing <efiring@...202...> wrote:
Andrew Kelly wrote:
Has anyone had any success in speeding up the mpl imports?
"import matplotlib.pyplot as plt"
( or "from matplotlib.figure import Figure")takes 6 full seconds to load. That seems excessive. Any ideas?
-Andy
Andy,
A couple replies came back directly to me (probably intended for the
list, though), and both reported results similar to yours, on Windows
machines only. What OS and version are you running?
Sorry Eric, that was indeed intended for the list. Just for the
list's sake, I'll repeat it:It takes longer than any other Python module for me, too, about 5-6
seconds on a "cold" load (on Windows), though faster on a "warm" load.
I am running it locally on a laptop that is 1.7 GHz Intel Pentium
laptop with 1Meg RAM.And I should add: I don't currently have Linux installed, but will
soon again I hope, and I will take note of how long it takes on Linux.Thanks,
Che------------------------------------------------------------------------------
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
matplotlib-users List Signup and Options
--
Michael Droettboom
Science Software Branch
Operations and Engineering Division
Space Telescope Science Institute
Operated by AURA for NASA
Just for the records,
It reads as:
python -c "import cProfile; cProfile.run(‘import pylab’, filename=‘test.out’)
in Python 2.6.2
These helped me to load the profile output:
import pstats
stats = pstats.Stats(“test.out”)
stats.print_stats()
On Fri, Apr 2, 2010 at 8:28 AM, Michael Droettboom <mdroe@…878…86…> wrote:
My gut says it’s probably the GUI framework import that is dominating
the time. Which backend are you using? Does importing it take a large
amount of time as well?
Can you provide a profiler output file we can examine to narrow it
down? The following from a command prompt should be sufficient to write
out a file called “import.prof”:
python.exe -c "import cProfile; prof=cProfile.Profile();
prof.run(‘import pylab’, ‘import.prof’)"
Mike
–
Gökhan