On Monday 30 July 2007 07:10:01 pm Eric Firing wrote:
> Darren Dale wrote:
> > I just committed changes in svn that will allow matplotlib to use the
> > experimental traited mplconfig module. The traited config object itself
> > is called mplConfig, but I wrapped it in an object called rcParams to
> > make it compatible with matplotlib, so we can kick the tires without
> > extensive changes.
>
> Darren,
>
> There is *major* speed problem.  Running "backend_driver.py Template":
>
> 0.95 minutes with NEWCONFIG = True
> 0.51 minutes                  False

I used the following script in the matplotlib/config directory to profile the 
mplconfig module:
def main():
    import mplconfig

if __name__=='__main__':
    import profile
    import pstats
    profile.run('main()', 'config.prof')
    
    p = pstats.Stats('config.prof')
    p.sort_stats('cumulative').print_stats(55)

I am attaching the results for two different tests. One is loading the default 
mpl-data/matplotlib.conf, the other is loading an empty 
~/.matplotlib/matplotlib.conf. I haven't done much work with profiling, maybe 
others can make some comments about the results.
Tue Jul 31 10:50:12 2007    config.prof

         192414 function calls (182927 primitive calls) in 2.032 CPU seconds

   Ordered by: internal time
   List reduced from 925 to 55 due to restriction <55>

   ncalls  tottime  percall  cumtime  percall filename:lineno(function)
      244    0.148    0.001    0.320    0.001 
/usr/lib64/python2.5/compiler/transformer.py:105(__init__)
32329/31952    0.116    0.000    0.116    0.000 :0(len)
    12044    0.108    0.000    0.108    0.000 :0(append)
     7677    0.108    0.000    0.144    0.000 
/usr/lib64/python2.5/sre_parse.py:188(__next)
    18236    0.096    0.000    0.104    0.000 :0(getattr)
    21644    0.092    0.000    0.096    0.000 :0(hasattr)
   358/40    0.084    0.000    0.388    0.010 
/usr/lib64/python2.5/sre_parse.py:385(_parse)
     7777    0.072    0.000    0.072    0.000 :0(isinstance)
       48    0.052    0.001    0.132    0.003 
/usr/lib64/python2.5/site-packages/enthought.traits-2.0b2.dev_r13165-py2.5-linux-x86_64.egg/enthought/traits/has_traits.py:558(__init__)
 1904/244    0.048    0.000    0.160    0.001 
/usr/lib64/python2.5/compiler/transformer.py:1060(com_binary)
   723/40    0.044    0.000    0.160    0.004 
/usr/lib64/python2.5/sre_compile.py:38(_compile)
 1027/347    0.040    0.000    0.044    0.000 
/usr/lib64/python2.5/sre_parse.py:146(getwidth)
      244    0.036    0.000    0.064    0.000 
/usr/lib64/python2.5/compiler/transformer.py:984(com_assign)
     6937    0.032    0.000    0.168    0.000 
/usr/lib64/python2.5/sre_parse.py:207(get)
      176    0.032    0.000    0.120    0.001 
/usr/lib64/python2.5/site-packages/pkg_resources.py:1645(find_on_path)
  246/245    0.028    0.000    0.140    0.001 
/usr/lib64/python2.5/site-packages/enthought.traits-2.0b2.dev_r13165-py2.5-linux-x86_64.egg/enthought/traits/traits.py:1577(define)
   248/40    0.024    0.000    0.388    0.010 
/usr/lib64/python2.5/sre_parse.py:307(_parse_sub)
     4815    0.024    0.000    0.024    0.000 :0(endswith)
        4    0.024    0.006    0.772    0.193 
/usr/local/src/matplotlib/matplotlib/lib/matplotlib/config/configobj.py:1410(_parse)
  141/139    0.024    0.000    0.072    0.001 
/usr/lib64/python2.5/site-packages/enthought.traits-2.0b2.dev_r13165-py2.5-linux-x86_64.egg/enthought/traits/traits.py:1710(do_list)
      832    0.020    0.000    0.028    0.000 
/usr/lib64/python2.5/posixpath.py:56(join)
 1220/244    0.020    0.000    0.020    0.000 
/usr/lib64/python2.5/compiler/transformer.py:1349(get_docstring)
 2412/244    0.020    0.000    0.140    0.001 
/usr/lib64/python2.5/compiler/transformer.py:787(com_node)
     2004    0.020    0.000    0.028    0.000 
/usr/lib64/python2.5/sre_parse.py:201(match)
      149    0.020    0.000    0.080    0.001 
/usr/lib64/python2.5/posixpath.py:410(realpath)
      276    0.020    0.000    0.020    0.000 
/usr/lib64/python2.5/site-packages/enthought.traits-2.0b2.dev_r13165-py2.5-linux-x86_64.egg/enthought/traits/traits.py:292(_default_value_type)
     3017    0.020    0.000    0.020    0.000 :0(get)
     2750    0.020    0.000    0.020    0.000 
/usr/lib64/python2.5/sre_parse.py:136(__getitem__)
  332/244    0.020    0.000    0.152    0.001 
/usr/lib64/python2.5/compiler/transformer.py:579(test)
      891    0.016    0.000    0.032    0.000 
/usr/lib64/python2.5/site-packages/enthought.traits-2.0b2.dev_r13165-py2.5-linux-x86_64.egg/enthought/traits/has_traits.py:128(_get_def)
      691    0.016    0.000    0.016    0.000 :0(match)
     2027    0.016    0.000    0.016    0.000 :0(range)
  332/244    0.016    0.000    0.116    0.000 
/usr/lib64/python2.5/compiler/transformer.py:611(comparison)
     3287    0.016    0.000    0.016    0.000 :0(lower)
      231    0.016    0.000    0.024    0.000 
/usr/lib64/python2.5/sre_compile.py:213(_optimize_charset)
      244    0.016    0.000    0.300    0.001 
/usr/lib64/python2.5/compiler/transformer.py:312(simple_stmt)
  246/245    0.012    0.000    0.152    0.001 
/usr/lib64/python2.5/site-packages/enthought.traits-2.0b2.dev_r13165-py2.5-linux-x86_64.egg/enthought/traits/traits.py:1569(__init__)
     3458    0.012    0.000    0.012    0.000 
/usr/lib64/python2.5/compiler/transformer.py:784(lookup_node)
      526    0.012    0.000    0.012    0.000 :0(items)
      144    0.012    0.000    0.028    0.000 
/usr/lib64/python2.5/site-packages/pkg_resources.py:465(add)
     1055    0.012    0.000    0.020    0.000 
/usr/lib64/python2.5/site-packages/pkg_resources.py:1790(_normalize_cached)
      424    0.012    0.000    0.016    0.000 
/usr/lib64/python2.5/site-packages/pkg_resources.py:2056(key)
      627    0.012    0.000    0.012    0.000 :0(ord)
      831    0.012    0.000    0.012    0.000 :0(strip)
      151    0.012    0.000    0.024    0.000 
/usr/lib64/python2.5/posixpath.py:373(normpath)
      776    0.012    0.000    0.012    0.000 :0(extend)
      244    0.008    0.000    0.352    0.001 
/usr/lib64/python2.5/compiler/transformer.py:180(file_input)
  332/244    0.008    0.000    0.080    0.000 
/usr/lib64/python2.5/compiler/transformer.py:656(shift_expr)
      306    0.008    0.000    0.008    0.000 
/usr/lib64/python2.5/sre_parse.py:140(__getslice__)
        4    0.008    0.002    0.780    0.195 
/usr/local/src/matplotlib/matplotlib/lib/matplotlib/config/configobj.py:1129(__init__)
  334/244    0.008    0.000    0.064    0.000 
/usr/lib64/python2.5/compiler/transformer.py:699(factor)
      897    0.008    0.000    0.020    0.000 
/usr/lib64/python2.5/sre_parse.py:144(append)
      244    0.008    0.000    0.168    0.001 
/usr/lib64/python2.5/compiler/transformer.py:563(testlist)
      144    0.008    0.000    0.028    0.000 
/usr/lib64/python2.5/site-packages/pkg_resources.py:2012(__init__)
      326    0.008    0.000    0.608    0.002 
/usr/lib64/python2.5/re.py:219(_compile)


Tue Jul 31 10:50:03 2007    config.prof

         192414 function calls (182927 primitive calls) in 1.976 CPU seconds

   Ordered by: internal time
   List reduced from 925 to 55 due to restriction <55>

   ncalls  tottime  percall  cumtime  percall filename:lineno(function)
      244    0.164    0.001    0.336    0.001 
/usr/lib64/python2.5/compiler/transformer.py:105(__init__)
32329/31952    0.128    0.000    0.136    0.000 :0(len)
    18236    0.108    0.000    0.108    0.000 :0(getattr)
     7677    0.104    0.000    0.148    0.000 
/usr/lib64/python2.5/sre_parse.py:188(__next)
    21644    0.096    0.000    0.096    0.000 :0(hasattr)
   358/40    0.080    0.000    0.364    0.009 
/usr/lib64/python2.5/sre_parse.py:385(_parse)
     6937    0.056    0.000    0.180    0.000 
/usr/lib64/python2.5/sre_parse.py:207(get)
    12044    0.056    0.000    0.056    0.000 :0(append)
     7777    0.052    0.000    0.052    0.000 :0(isinstance)
  246/245    0.036    0.000    0.100    0.000 
/usr/lib64/python2.5/site-packages/enthought.traits-2.0b2.dev_r13165-py2.5-linux-x86_64.egg/enthought/traits/traits.py:1577(define)
   723/40    0.036    0.000    0.136    0.003 
/usr/lib64/python2.5/sre_compile.py:38(_compile)
      176    0.032    0.000    0.108    0.001 
/usr/lib64/python2.5/site-packages/pkg_resources.py:1645(find_on_path)
     3287    0.032    0.000    0.032    0.000 :0(lower)
       48    0.032    0.001    0.116    0.002 
/usr/lib64/python2.5/site-packages/enthought.traits-2.0b2.dev_r13165-py2.5-linux-x86_64.egg/enthought/traits/has_traits.py:558(__init__)
 1027/347    0.024    0.000    0.056    0.000 
/usr/lib64/python2.5/sre_parse.py:146(getwidth)
     1611    0.024    0.000    0.024    0.000 :0(min)
      244    0.024    0.000    0.056    0.000 
/usr/lib64/python2.5/compiler/transformer.py:984(com_assign)
        4    0.024    0.006    0.800    0.200 
/usr/local/src/matplotlib/matplotlib/lib/matplotlib/config/configobj.py:1410(_parse)
  332/244    0.020    0.000    0.108    0.000 
/usr/lib64/python2.5/compiler/transformer.py:656(shift_expr)
 1904/244    0.020    0.000    0.188    0.001 
/usr/lib64/python2.5/compiler/transformer.py:1060(com_binary)
  488/244    0.016    0.000    0.304    0.001 
/usr/lib64/python2.5/compiler/transformer.py:1072(com_stmt)
      244    0.016    0.000    0.296    0.001 
/usr/lib64/python2.5/compiler/transformer.py:312(simple_stmt)
  332/244    0.016    0.000    0.144    0.001 
/usr/lib64/python2.5/compiler/transformer.py:604(not_test)
     3967    0.016    0.000    0.016    0.000 :0(startswith)
      231    0.016    0.000    0.032    0.000 
/usr/lib64/python2.5/sre_compile.py:184(_compile_charset)
      144    0.016    0.000    0.016    0.000 
/usr/lib64/python2.5/site-packages/pkg_resources.py:465(add)
      897    0.016    0.000    0.016    0.000 
/usr/lib64/python2.5/sre_parse.py:144(append)
 2412/244    0.016    0.000    0.176    0.001 
/usr/lib64/python2.5/compiler/transformer.py:787(com_node)
     2750    0.016    0.000    0.016    0.000 
/usr/lib64/python2.5/sre_parse.py:136(__getitem__)
      332    0.016    0.000    0.024    0.000 
/usr/local/src/matplotlib/matplotlib/lib/matplotlib/config/configobj.py:537(__setitem__)
 1220/244    0.016    0.000    0.016    0.000 
/usr/lib64/python2.5/compiler/transformer.py:1349(get_docstring)
      691    0.012    0.000    0.012    0.000 :0(match)
     1426    0.012    0.000    0.012    0.000 
/usr/lib64/python2.5/sre_parse.py:132(__len__)
     1030    0.012    0.000    0.012    0.000 :0(has_key)
      891    0.012    0.000    0.024    0.000 
/usr/lib64/python2.5/site-packages/enthought.traits-2.0b2.dev_r13165-py2.5-linux-x86_64.egg/enthought/traits/has_traits.py:128(_get_def)
     4815    0.012    0.000    0.012    0.000 :0(endswith)
      244    0.012    0.000    0.264    0.001 
/usr/lib64/python2.5/compiler/transformer.py:351(expr_stmt)
      268    0.012    0.000    0.012    0.000 :0(eval)
      244    0.012    0.000    0.012    0.000 
/usr/lib64/python2.5/compiler/ast.py:175(getChildren)
       58    0.012    0.000    0.028    0.000 
/usr/lib64/python2.5/site-packages/enthought.traits-2.0b2.dev_r13165-py2.5-linux-x86_64.egg/enthought/traits/has_traits.py:2210(add_trait)
       40    0.012    0.000    0.064    0.002 
/usr/lib64/python2.5/sre_compile.py:367(_compile_info)
   248/40    0.012    0.000    0.364    0.009 
/usr/lib64/python2.5/sre_parse.py:307(_parse_sub)
       34    0.012    0.000    0.136    0.004 
/usr/lib64/python2.5/site-packages/pkg_resources.py:387(add_entry)
      642    0.012    0.000    0.012    0.000 
/usr/lib64/python2.5/stat.py:60(S_ISLNK)
      244    0.012    0.000    0.012    0.000 
/usr/lib64/python2.5/compiler/transformer.py:1044(com_assign_name)
  332/244    0.012    0.000    0.156    0.001 
/usr/lib64/python2.5/compiler/transformer.py:600(and_test)
      302    0.008    0.000    0.008    0.000 :0(groups)
      244    0.008    0.000    0.332    0.001 
/usr/lib64/python2.5/compiler/transformer.py:121(transform)
      192    0.008    0.000    0.012    0.000 
/usr/lib64/python2.5/site-packages/pkg_resources.py:2119(_get_metadata)
  246/245    0.008    0.000    0.112    0.000 
/usr/lib64/python2.5/site-packages/enthought.traits-2.0b2.dev_r13165-py2.5-linux-x86_64.egg/enthought/traits/traits.py:1569(__init__)
     2027    0.008    0.000    0.008    0.000 :0(range)
      723    0.008    0.000    0.008    0.000 
/usr/lib64/python2.5/sre_parse.py:96(__init__)
     2004    0.008    0.000    0.032    0.000 
/usr/lib64/python2.5/sre_parse.py:201(match)
        1    0.008    0.008    0.008    0.008 
/usr/lib64/python2.5/site-packages/enthought.traits-2.0b2.dev_r13165-py2.5-linux-x86_64.egg/enthought/traits/trait_notifiers.py:24(<module>)
      151    0.008    0.000    0.024    0.000 
/usr/lib64/python2.5/posixpath.py:400(abspath)


-------------------------------------------------------------------------
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

Reply via email to