[Erp5-report] r43423 jm - /erp5/trunk/products/ERP5Type/dynamic/lazy_class.py

nobody at svn.erp5.org nobody at svn.erp5.org
Thu Feb 17 15:32:46 CET 2011


Author: jm
Date: Thu Feb 17 15:32:46 2011
New Revision: 43423

URL: http://svn.erp5.org?rev=43423&view=rev
Log:
Speed up PortalTypeMetaClass.getAccessorHolderPropertyList by ~10%

Modified:
    erp5/trunk/products/ERP5Type/dynamic/lazy_class.py

Modified: erp5/trunk/products/ERP5Type/dynamic/lazy_class.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5Type/dynamic/lazy_class.py?rev=43423&r1=43422&r2=43423&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Type/dynamic/lazy_class.py [utf8] (original)
+++ erp5/trunk/products/ERP5Type/dynamic/lazy_class.py [utf8] Thu Feb 17 15:32:46 2011
@@ -143,17 +143,12 @@ class PortalTypeMetaClass(GhostBaseMetaC
     @see Products.ERP5Type.Base.Base._propertyMap
     """
     cls.loadClass()
-    property_id_set = set()
-    property_list = []
+    property_dict = {}
     for klass in cls.mro():
       if klass.__module__ == 'erp5.accessor_holder':
         for property in klass._properties:
-          if property['id'] in property_id_set:
-            continue
-          property_id_set.update([property['id']])
-          property_list.append(property)
-
-    return property_list
+          property_dict.setdefault(property['id'], property)
+    return property_dict.values()
 
   def resetAcquisition(cls):
     # First, fill the __get__ slot of the class



More information about the Erp5-report mailing list