[PEAK] Re: Trellis Update Blues...

Peter Damoc pdamoc at gmail.com
Wed Jun 18 08:42:02 EDT 2008

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

Any ideas?


On Wed, Jun 18, 2008 at 11:55 AM, Peter Damoc <pdamoc at gmail.com> wrote:

> Hi all,
> I took the dive today and updated the code to the new Trellis format.
> In the end it wasn't as bad as I thought it be from a code change point of
> view.
> Unfortunately now I'm seeing an almost 10 fold decrease in the performance
> of my code.
> Nothing is change except the trellis adaptation to the new API.
> 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.
> 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)
> Any idea about how should I approach this predicament is welcomed.
> What should I try?
> Peter
> --
> There is NO FATE, we are the creators.

There is NO FATE, we are the creators.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.eby-sarna.com/pipermail/peak/attachments/20080618/6e933c48/attachment.html

More information about the PEAK mailing list