dabo Commit
Revision 6809
Date: 2011-08-30 18:05:52 -0700 (Tue, 30 Aug 2011)
Author: Paul
Trac: http://trac.dabodev.com/changeset/6809
Changed:
U trunk/dabo/biz/dBizobj.py
Log:
Additions to my test function. One problem with this approach is that old
cursors
can keep piling up, cursors we have no interest in dealing with because they
were
from older parent requeries. If we filter them out, we add overhead, and if we
pop them out of the __cursors dict upon requery(), we add overhead. We could add
an 'unused' flag to all __cursors upon parent requery(), and take away the flag
when the cursor becomes the _CurrentCursor, and then use the flag to speed up
traversal in isAnyChanged()...
Diff:
Modified: trunk/dabo/biz/dBizobj.py
===================================================================
--- trunk/dabo/biz/dBizobj.py 2011-08-30 21:54:02 UTC (rev 6808)
+++ trunk/dabo/biz/dBizobj.py 2011-08-31 01:05:52 UTC (rev 6809)
@@ -1468,18 +1468,27 @@
return ret
- def _isAnyChanged(self):
+ def _isAnyChanged(self, useCurrentParent=False,
includeNewUnchanged=None):
"""Contender to replace isAnyChanged(): better performance."""
beg = time.time()
- for v in self.__cursors.values():
- if v.isChanged():
+ if includeNewUnchanged is None:
+ includeNewUnchanged = self.SaveNewUnchanged
+ if useCurrentParent:
+ cursor = self.__cursors.get(self.getParentLinkValue(),
None)
+ if cursor is None or cursor.RowCount == 0:
+ return False
+ cursors = [cursor]
+ else:
+ cursors = self.__cursors.values()
+ for v in cursors:
+ if v.isChanged(includeNewUnchanged=includeNewUnchanged):
return True
for child in self.getChildren():
- if child._isAnyChanged():
+ if
child._isAnyChanged(includeNewUnchanged=includeNewUnchanged):
return True
end = time.time()
## The time it takes to get to False is the longest potential
time
- print "time for False:", end-beg, self
+ #print "time for False:", end-beg, self
return False
@@ -1508,6 +1517,9 @@
return ret
+ #isAnyChanged =_isAnyChanged ## for testing replacement function
+
+
def isRowChanged(self, includeNewUnchanged=None):
"""
Return True if data has changed in the current and only current
row
_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-dev
Searchable Archives: http://leafe.com/archives/search/dabo-dev
This message:
http://leafe.com/archives/byMID/[email protected]