Hi guys, [ For the Enthought gang, sorry for the cross-post. This is the context:
http://www.mail-archive.com/matplotlib-devel@lists.sourceforge.net/msg01451.html We're trying to see if it would be reasonable to use Traits for the matplotlib config description, but there seem to be performance issues. ] On 7/31/07, Eric Firing <[EMAIL PROTECTED]> wrote: > Darren, > > The two cases you ran have almost identical timing, so the problem is > not in reading matplotlib.conf. Instead, it seems to be in the > initialization of all the machinery, and I suspect that something may > be getting run many times in a loop instead of just once. I used the > profile.py script method to profile the whole simple_plot.py demo > modified to use Agg, with NEWCONFIG True versus False. Attached are the > top 100 lines of the output, sorted by cumulative time, with "new" > meaning NEWCONFIG=True. The execution time of the new version is 3.2 > seconds versus 1.8 for the old. (Both are pretty slow for making a > minimal plot from a script.) > I'm here at scipy'07 with the Enthought folks and trying to see if we can understand what the issue with this traits startup cost is. But I tried (with current SVN) to run a simple python -c 'import pylab;pylab.plot([1,2,3])' but I'm gettting: obj: plain Traceback (most recent call last): File "<string>", line 1, in <module> File "/home/fperez/usr/opt/lib/python2.5/site-packages/matplotlib/pylab.py", line 2061, in plot b = ishold() File "/home/fperez/usr/opt/lib/python2.5/site-packages/matplotlib/pylab.py", line 888, in ishold return gca().ishold() File "/home/fperez/usr/opt/lib/python2.5/site-packages/matplotlib/pylab.py", line 834, in gca ax = gcf().gca(**kwargs) File "/home/fperez/usr/opt/lib/python2.5/site-packages/matplotlib/figure.py", line 722, in gca return self.add_subplot(111, **kwargs) File "/home/fperez/usr/opt/lib/python2.5/site-packages/matplotlib/figure.py", line 542, in add_subplot a = Subplot(self, *args, **kwargs) File "/home/fperez/usr/opt/lib/python2.5/site-packages/matplotlib/axes.py", line 5157, in __init__ self.figW, self.figH], **kwargs) File "/home/fperez/usr/opt/lib/python2.5/site-packages/matplotlib/axes.py", line 507, in __init__ self._init_axis() File "/home/fperez/usr/opt/lib/python2.5/site-packages/matplotlib/axes.py", line 545, in _init_axis self.xaxis = maxis.XAxis(self) File "/home/fperez/usr/opt/lib/python2.5/site-packages/matplotlib/axis.py", line 512, in __init__ self.label = self._get_label() File "/home/fperez/usr/opt/lib/python2.5/site-packages/matplotlib/axis.py", line 990, in _get_label horizontalalignment='center', File "/home/fperez/usr/opt/lib/python2.5/site-packages/matplotlib/text.py", line 178, in __init__ self.set_markup(markup) File "/home/fperez/usr/opt/lib/python2.5/site-packages/matplotlib/text.py", line 780, in set_markup self._markup = rcParams['text.markup'] File "/home/fperez/usr/opt/lib/python2.5/site-packages/matplotlib/config/mplconfig.py", line 438, in __getitem__ return getattr(obj, attr) AttributeError: 'str' object has no attribute 'markup' where the crash is coming from this (run interactively in ipdb): /home/fperez/usr/opt/lib/python2.5/site-packages/matplotlib/config/mplconfig.py in __getitem__(self, key) 436 obj, attr = self.tconfig_map[key] 437 print 'obj:',obj --> 438 return getattr(obj, attr) 439 440 def keys(self): AttributeError: 'str' object has no attribute 'markup' In [2]: obj: MPLConfig In [3]: debug > /home/fperez/usr/opt/lib/python2.5/site-packages/matplotlib/config/mplconfig.py(438)__getitem__() 437 print 'obj:',obj --> 438 return getattr(obj, attr) 439 ipdb> print obj plain ipdb> print attr markup ipdb> print type(obj) <type 'str'> It looks like the 'text' object access is one level off, since it's trying to get 'markup' from 'plain', which is the *value* of 'text.markup' in the traits description. This is with a just-built SVN. If any of you could look into this (I can't really hack on it right now) it would be great, since we can look at the performance issues with the Enthought team, but we need the code to actually run. If Eric/Darren want to talk directly, write to me off-list and I can call you on a phone. Cheers, f ------------------------------------------------------------------------- This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/ _______________________________________________ Matplotlib-devel mailing list Matplotlib-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-devel