dabo Commit
Revision 6807
Date: 2011-08-30 14:53:58 -0700 (Tue, 30 Aug 2011)
Author: Paul
Trac: http://trac.dabodev.com/changeset/6807

Changed:
U   trunk/dabo/biz/dBizobj.py

Log:
Proposal for new isAnyChanged() function, that iterates private data
instead of scanning the bizobj hierarchy to find changes. The idea
is that we want an efficient answer to one question: are there any
changed records? So, return True as soon as one is found, and do it
as quickly as possible.

See thread on dabo-dev regarding r6595 on 30-Aug 2011.



Diff:
Modified: trunk/dabo/biz/dBizobj.py
===================================================================
--- trunk/dabo/biz/dBizobj.py   2011-08-30 19:37:04 UTC (rev 6806)
+++ trunk/dabo/biz/dBizobj.py   2011-08-30 21:53:58 UTC (rev 6807)
@@ -1468,6 +1468,21 @@
                return ret
 
 
+       def _isAnyChanged(self):
+               """Contender to replace isAnyChanged(): better performance."""
+               beg = time.time()
+               for v in self.__cursors.values():
+                       if v.isChanged():
+                               return True
+               for child in self.getChildren():
+                       if child._isAnyChanged():
+                               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
+               return False
+
+       
        def isAnyChanged(self, useCurrentParent=None, includeNewUnchanged=None):
                """
                Returns True if any record in the current record set has been 
changed.



_______________________________________________
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]

Reply via email to