[Erp5-report] r21165 - /erp5/trunk/products/ERP5Type/tests/testPerformance.py

nobody at svn.erp5.org nobody at svn.erp5.org
Tue May 27 11:57:42 CEST 2008


Author: vincent
Date: Tue May 27 11:57:41 2008
New Revision: 21165

URL: http://svn.erp5.org?rev=21165&view=rev
Log:
Instead of explicitely collecting in hope of collection not happening in tests, simply disable garbage collection.

Modified:
    erp5/trunk/products/ERP5Type/tests/testPerformance.py

Modified: erp5/trunk/products/ERP5Type/tests/testPerformance.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5Type/tests/testPerformance.py?rev=21165&r1=21164&r2=21165&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Type/tests/testPerformance.py (original)
+++ erp5/trunk/products/ERP5Type/tests/testPerformance.py Tue May 27 11:57:41 2008
@@ -53,6 +53,17 @@
 LISTBOX_COEF=0.02472
 DO_TEST = 1
 
+# Prevent GC from happening.
+# We don't want cpu time to be spent outside of python code if possible.
+# It would increase the "crosstalk" between using more ram and using more cpu.
+# Another problem is that it makes result even less reproductible on another
+# machine where memory use does not evolve identicaly (ie. x86_64 arch,
+# because of 64bits pointers).
+gc.disable()
+# XXX: Maybe it would be usefull to explicitely collect garbage in some places
+# to keep memory usage low. But it is generaly bad to apply the cure before
+# even knowing if the symptoms will show up.
+
 class TestPerformance(ERP5TypeTestCase, LogInterceptor):
 
     # Some helper methods
@@ -157,7 +168,6 @@
       view_result = {}
       tic_result = {}
       add_result = {}
-      gc.collect()
       # add object in bar module
       for i in xrange(10):
           before_add = time()
@@ -170,12 +180,6 @@
           before_tic = time()
           self.tic()
           after_tic = time()
-
-          # Explicit collect of the garbage collector,
-          # So no garbage collection will happen while reindexing,
-          # like this we prevent random garbage collection wich 
-          # was making the test failing randomly
-          gc.collect()
 
           before_form = time()
           for x in xrange(100):




More information about the Erp5-report mailing list