bbreslauer / PySciPlot

GNU General Public License v3.0
1 stars 0 forks source link

Speed up plotting #55

Open bbreslauer opened 13 years ago

bbreslauer commented 13 years ago

It looks to take ~4.6s to plot a blank 2x2 grid of plots after pressing apply. Want to try and get that down, and then deal with delays with plotting data on top of it.

It looks like findChild is called a lot and uses a significant amount of times. Also, try and do everything to set up the plot, and then only draw it once, instead of after changing each option.

>>> p.print_stats(20)
Fri Jun 10 21:15:58 2011    profiling.prof

         5425346 function calls (5335483 primitive calls) in 19.613 seconds

   Ordered by: internal time
   List reduced from 3250 to 20 due to restriction <20>

   ncalls  tottime  percall  cumtime  percall filename:lineno(function)
        1    7.381    7.381   15.426   15.426 {built-in method exec_}
      753    0.687    0.001    0.687    0.001 {built-in method findChild}
    86478    0.528    0.000    0.528    0.000 {numpy.core.multiarray.array}
    30409    0.413    0.000    0.818    0.000 path.py:83(__init__)
   106082    0.392    0.000    0.392    0.000 {posix.lstat}
     1351    0.357    0.000    0.357    0.000 {posix.listdir}
     9744    0.325    0.000    0.363    0.000 {built-in method draw_markers}
     9744    0.313    0.000    4.019    0.000 lines.py:497(draw)
    10542    0.251    0.000    0.808    0.000 lines.py:420(recache)
   417006    0.244    0.000    0.244    0.000 {built-in method match}
       32    0.230    0.007    0.230    0.007 {method 'read' of 'file' objects}
    24588    0.220    0.000    0.373    0.000 colors.py:317(to_rgba)
     2531    0.211    0.000    0.211    0.000 {built-in method FT2Font}
   253/46    0.202    0.001    0.962    0.021 posixpath.py:209(walk)
   318623    0.202    0.000    0.202    0.000 {isinstance}
26684/26348    0.202    0.000    0.767    0.000 transforms.py:1731(transform)
    37240    0.199    0.000    0.199    0.000 {numpy.core.multiarray.concatenate}
    30409    0.186    0.000    0.186    0.000 {method 'all' of 'numpy.ndarray' objects}
   112061    0.160    0.000    0.238    0.000 posixpath.py:60(join)
86295/86281    0.137    0.000    0.352    0.000 transforms.py:1415(transform)
bbreslauer commented 13 years ago

It might be that in Figure.refreshPlots, it creates new matplotlib axes for each Plot every time the figure is refreshed. This might be a big slowdown that can be removed, but I'm not sure yet. Need to test.