More tests and data.<br><br>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)<br>
<br>then I pushed some of the cache code in an exterior method and timed it for both versions. <br><br>here is the code:<br>#------- start code<br>import timeit<br>stmt = """<br>def render_nimf_distance_anim(mp):<br>
n_hdev = mp.n_hdev<br> n_hdev2 = mp.n_hdev2<br> n_vdev = mp.n_vdev<br> n_vdev2 = mp.n_vdev2<br> breast_base_h = mp.breast_base_h<br> breast_base_h2 = mp.breast_base_h2<br> lower_pole = mp.lower_pole <br>
lower_pole2 = mp.lower_pole2 <br> lower_pole_base = mp.lower_pole_base<br> lower_pole_base2 = mp.lower_pole_base2<br> lower_pole_with_ptosis = mp.lower_pole_with_ptosis<br> lower_pole_with_ptosis2 = mp.lower_pole_with_ptosis2<br>
future_nimf = mp.future_nimf<br> future_nimf2 = mp.future_nimf2<br> future_imf_pos = mp.future_imf_pos<br> future_imf_pos2 = mp.future_imf_pos2<br> incision_pos = mp.incision_pos<br> incision_pos2 = mp.incision_pos2<br>
<br>from measurements import Measurements, MeasurementsProxy<br><br>m = Measurements()<br>mp = MeasurementsProxy()<br>for x in range(100):<br> render_nimf_distance_anim(mp)"""<br>t = timeit.Timer(stmt=stmt)<br>
print t.timeit(number=10)<br><br>#------- end code<br><br>the results were:<br>0.7a2: 36.40 seconds<br>0.6a3: 0.55 seconds<br><br>The only thing I modified was replacing trellis.values with trellis.attrs and trellis.rule with trellis.compute (trellis.rules with trellis.compute.attrs)<br>
<br>Any ideas?<br><br>Peter<br><br><br><div class="gmail_quote">On Wed, Jun 18, 2008 at 11:55 AM, Peter Damoc <<a href="mailto:email@example.com">firstname.lastname@example.org</a>> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Hi all,<br><br>I took the dive today and updated the code to the new Trellis format. <br>In the end it wasn't as bad as I thought it be from a code change point of view. <br><br>Unfortunately now I'm seeing an almost 10 fold decrease in the performance of my code. <br>
Nothing is change except the trellis adaptation to the new API.<br>Before change, using Trellis 0.6a3, I got something like 40 ms execution of a drawing method. Now I'm getting 344 ms with 0.7a2.<br><br>My trellis component is basically comprised of a dictionary containing a series of measurements and a group of attrs and compute attrs that use these measurements to output the drawing parameters. (around 400 LOC) <br>
<br>Any idea about how should I approach this predicament is welcomed. <br>What should I try?<br><br>Peter<br><font color="#888888"><br>-- <br>There is NO FATE, we are the creators.
</font></blockquote></div><br><br clear="all"><br>-- <br>There is NO FATE, we are the creators.