bug 9877; fix performace with people tree view and some filters
When using deep relationship filters on the person tree view with a large tree, the tree redraw can take a long time (hours). The DeepRelationshipPathBetween 'prepare' method was getting called for every person in the preceding filter. And that it also ran through every person in the db within the prepare method. Resulting in time as a square function of number of people. Change view code so that 'prepare' method is called once, and 'apply' method is called once with list of handles to scan, rather than both called once per handle.
This commit is contained in:
@@ -591,16 +591,20 @@ class TreeBaseModel(GObject.GObject, Gtk.TreeModel, BaseModel):
|
|||||||
pmon.add_op(status_ppl)
|
pmon.add_op(status_ppl)
|
||||||
|
|
||||||
self.__total += items
|
self.__total += items
|
||||||
|
assert not skip
|
||||||
with gen_cursor() as cursor:
|
if dfilter:
|
||||||
for handle, data in cursor:
|
for handle in dfilter.apply(self.db,
|
||||||
if not isinstance(handle, str):
|
cb_progress=status_ppl.heartbeat):
|
||||||
handle = handle.decode('utf-8')
|
data = data_map(handle)
|
||||||
status_ppl.heartbeat()
|
|
||||||
if not handle in skip:
|
|
||||||
if not dfilter or dfilter.match(handle, self.db):
|
|
||||||
add_func(handle, data)
|
add_func(handle, data)
|
||||||
self.__displayed += 1
|
self.__displayed += 1
|
||||||
|
else:
|
||||||
|
with gen_cursor() as cursor:
|
||||||
|
for handle, data in cursor:
|
||||||
|
status_ppl.heartbeat()
|
||||||
|
add_func(handle, data)
|
||||||
|
self.__displayed += 1
|
||||||
|
|
||||||
status_ppl.end()
|
status_ppl.end()
|
||||||
status.end()
|
status.end()
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user