Commit a3a74797 authored by Vincent Pelletier's avatar Vincent Pelletier

Instead of explicitely collecting in hope of collection not happening in...

Instead of explicitely collecting in hope of collection not happening in tests, simply disable garbage collection.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@21165 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 3ef8f6db
...@@ -53,6 +53,17 @@ MAX_TIC=0.0355 ...@@ -53,6 +53,17 @@ MAX_TIC=0.0355
LISTBOX_COEF=0.02472 LISTBOX_COEF=0.02472
DO_TEST = 1 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): class TestPerformance(ERP5TypeTestCase, LogInterceptor):
# Some helper methods # Some helper methods
...@@ -157,7 +168,6 @@ class TestPerformance(ERP5TypeTestCase, LogInterceptor): ...@@ -157,7 +168,6 @@ class TestPerformance(ERP5TypeTestCase, LogInterceptor):
view_result = {} view_result = {}
tic_result = {} tic_result = {}
add_result = {} add_result = {}
gc.collect()
# add object in bar module # add object in bar module
for i in xrange(10): for i in xrange(10):
before_add = time() before_add = time()
...@@ -171,12 +181,6 @@ class TestPerformance(ERP5TypeTestCase, LogInterceptor): ...@@ -171,12 +181,6 @@ class TestPerformance(ERP5TypeTestCase, LogInterceptor):
self.tic() self.tic()
after_tic = time() 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() before_form = time()
for x in xrange(100): for x in xrange(100):
self.bar_module.BarModule_viewBarList() self.bar_module.BarModule_viewBarList()
......
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