Re: Re: Trellis Update Blues...
"Phillip J. Eby" <pje-Wh6+Hckhi6HFNGf7iClzIwC/[email protected]>
| Newsgroups | gmane.comp.python.peak |
|---|---|
| Message-ID | <[email protected]> |
At 03:42 PM 6/18/2008 +0300, Peter Damoc wrote: >More tests and data. > >I've simply cached some values and started to see improvements which >was strange... (it means that somehow the trellis component >recomputes some of the measurements or provides a way slower access >to the results) > >then I pushed some of the cache code in an exterior method and timed >it for both versions. > >here is the code: >#------- start code >import timeit >stmt = """ >def render_nimf_distance_anim(mp): > n_hdev = mp.n_hdev > n_hdev2 = mp.n_hdev2 > n_vdev = mp.n_vdev > n_vdev2 = mp.n_vdev2 > breast_base_h = mp.breast_base_h > breast_base_h2 = mp.breast_base_h2 > lower_pole = mp.lower_pole > lower_pole2 = mp.lower_pole2 > lower_pole_base = mp.lower_pole_base > lower_pole_base2 = mp.lower_pole_base2 > lower_pole_with_ptosis = mp.lower_pole_with_ptosis > lower_pole_with_ptosis2 = mp.lower_pole_with_ptosis2 > future_nimf = mp.future_nimf > future_nimf2 = mp.future_nimf2 > future_imf_pos = mp.future_imf_pos > future_imf_pos2 = mp.future_imf_pos2 > incision_pos = mp.incision_pos > incision_pos2 = mp.incision_pos2 > >from measurements import Measurements, MeasurementsProxy > >m = Measurements() >mp = MeasurementsProxy() >for x in range(100): > render_nimf_distance_anim(mp)""" >t = timeit.Timer(stmt=stmt) >print t.timeit(number=10) > >#------- end code > >the results were: >0.7a2: 36.40 seconds >0.6a3: 0.55 seconds > >The only thing I modified was replacing trellis.values with >trellis.attrs and trellis.rule with trellis.compute (trellis.rules >with trellis.compute.attrs) > >Any ideas? Please send me the code I would need to actually reproduce this, so I can profile it. The code above tells me nothing about what's actually going on.