launchpad-dev team mailing list archive
-
launchpad-dev team
-
Mailing list archive
-
Message #05003
Re: Performance Tuesday: enhancement; analysis; questions
On Wed, Oct 6, 2010 at 2:16 PM, Ian Booth <ian.booth@xxxxxxxxxxxxx> wrote:
>> It already does; you probably have two domain object instances, not
>> one instance with two caches. There are a few ways this could occur;
>> what particular object and cached attribute are you looking at? (so
>> that I can look at the code).
>>
>
> Since you asked...
>
> The driver for what's loaded is the page template - person-branches.pt
> Here's a snippet:
>
> <div style="float:right" id="floating-links"
> tal:define="menu context/menu:branches">
> <div tal:define="link menu/addbranch"
> tal:condition="link/enabled"
> tal:content="structure link/render" />
> </div>
>
> <tal:summary replace="structure context/@@+codesummary"/>
>
> One instance of PersonBranchesMenu (from code.browser.branchlisting.py)
> is created due to tal:define="menu context/menu:branches" and the other
> comes from the macro @@+codesummary (ieperson-codesummary.pt) which also
> has the same tal:define. These menu objects are for the same underlying
> data but two separate runtime instances (with different object ids) of
> PersonBranchesMenu are created, one for each tal:define. And each of
> these instances has a separate property cache.
So what I'd do is push the cache down to context object; this might be
as simple as assigning the attributes you use to something on the
context, or perhaps just make repeatedly accessing the source data
cheap (by cachedproperty).
> I'll followup on your other suggestions, and also read the link sent by
> mwhudson - the discussion pre-dates my join date by a mere 5 days :-)
>
> Thanks for the input. I'm still learning the finer detail of how zope
> infrastructure works so forgive me if my questions seem elementary
> sometimes :-)
Not at all; a significant chunk of the development cycle time in
Launchpad is action at a distance, so its to be expected that there
will be nonobvious things that take a while to encounter.
-Rob
References