On Oct 4, 2006, at 3:30 PM, Grant Baillie wrote:

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'.

Right -- rather than reimplementing Calculated, I did this:

        try:
testVal = view.findValue(key, getattr(EventStamp, startAttrName).name)
        except AttributeError:
# Guess we have to load the item, since findValue can't retrieve a
            # Calculated
            testVal = getattr(EventStamp(view[key]), startAttrName)

The exception only happened a few times (for those 'effective' times), but overall there wasn't much change to the timings.
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

Open Source Applications Foundation "chandler-dev" mailing list
http://lists.osafoundation.org/mailman/listinfo/chandler-dev

Reply via email to