Commit 3c7872c4 authored by Yoshinori Okuji's avatar Yoshinori Okuji

Implement an argument cache. This speeds up the indexing of movements 1.5 time faster.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@3850 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 743bcfa4
...@@ -935,6 +935,8 @@ class Catalog(Folder, Persistent, Acquisition.Implicit, ExtensionClass.Base): ...@@ -935,6 +935,8 @@ class Catalog(Folder, Persistent, Acquisition.Implicit, ExtensionClass.Base):
methods = self.sql_catalog_object_list methods = self.sql_catalog_object_list
econtext_cache = {} econtext_cache = {}
argument_cache = {}
for method_name in methods: for method_name in methods:
kw = {} kw = {}
#LOG('catalogObjectList', 0, 'method_name = %s, self.isMethodFiltered(method_name) = %r, self.filter_dict.has_key(method_name) = %r' % (method_name, self.isMethodFiltered(method_name), self.filter_dict.has_key(method_name))) #LOG('catalogObjectList', 0, 'method_name = %s, self.isMethodFiltered(method_name) = %r, self.filter_dict.has_key(method_name) = %r' % (method_name, self.isMethodFiltered(method_name), self.filter_dict.has_key(method_name)))
...@@ -975,18 +977,17 @@ class Catalog(Folder, Persistent, Acquisition.Implicit, ExtensionClass.Base): ...@@ -975,18 +977,17 @@ class Catalog(Folder, Persistent, Acquisition.Implicit, ExtensionClass.Base):
value_list = [] value_list = []
append = value_list.append append = value_list.append
for object in catalogged_object_list: for object in catalogged_object_list:
#LOG('catalog_object_list: object.uid',0,getattr(object,'uid',None))
#LOG('catalog_object_list: object.path',0,object.getPhysicalPath())
try: try:
value = getattr(object, arg, None) value = argument_cache[(object.uid, arg)]
if callable(value): except KeyError:
value = value() try:
#if arg == 'optimised_roles_and_users': value = getattr(object, arg, None)
# LOG('catalogObjectList', 0, 'object = %r, arg = %r, value = %r' % (object, arg, value,)) if callable(value):
append(value) value = value()
except: except:
#LOG("SQLCatalog Warning: Callable value could not be called",0,str((path, arg, method_name))) value = None
append(None) argument_cache[(object.uid, arg)] = value
append(value)
kw[arg] = value_list kw[arg] = value_list
method = aq_base(method).__of__(self) # Use method in the context of portal_catalog method = aq_base(method).__of__(self) # Use method in the context of portal_catalog
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment