[Chandler-dev] Pre-loading items as a performance optimization

Grant Baillie grant at osafoundation.org
Wed Oct 4 15:30:10 PDT 2006


On 4 Oct, 2006, at 14:37, Morgen Sagen wrote:

> I did try replacing those mStart and mEnd calls like this:
>
>    testVal = getattr(EventStamp(view[key]), startAttrName)
>
> with calls like this:
>
>    testVal = view.findValue(key, getattr(EventStamp,  
> startAttrName).name)
>
> to avoid loading, but overall a similar number of items was being  
> loaded anyway (32 items loaded versus 34, if I recall).  Also,  
> there are some cases where findValue( ) doesn't work -- when an  
> attribute is Calculated, the item needs to be loaded and getattr used.

True, but you can refactor the Calculated to work with view.findValues 
(). This is hard to do in the general case, but it turns out that  
those mStart() and mEnd() functions are only ever called with a  
startAttr of 'effectiveStartTime' and endAttr of 'effectiveEndTime'.

--Grant




More information about the chandler-dev mailing list