Commit 5fc51e22 authored by Jérome Perrin's avatar Jérome Perrin

increase the number of iterations otherwise the method might take less than one second to compute


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@23711 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent a419e945
...@@ -240,17 +240,21 @@ return result ...@@ -240,17 +240,21 @@ return result
print print
print "="*40 print "="*40
print "TESTING:", cf_name print "TESTING:", cf_name
# if the test fails because your machine is too fast, increase this value.
nb_iterations = 30000
portal.portal_caches.clearCacheFactory(cf_name) portal.portal_caches.clearCacheFactory(cf_name)
## 1st call ## 1st call
start = time.time() start = time.time()
original = my_cache(20000, portal_path=('', portal.getId())) original = my_cache(nb_iterations, portal_path=('', portal.getId()))
end = time.time() end = time.time()
calculation_time = end-start calculation_time = end-start
print "\n\tCalculation time (1st call)", calculation_time print "\n\tCalculation time (1st call)", calculation_time
## 2nd call - should be cached now ## 2nd call - should be cached now
start = time.time() start = time.time()
cached = my_cache(20000, portal_path=('', portal.getId())) cached = my_cache(nb_iterations, portal_path=('', portal.getId()))
end = time.time() end = time.time()
calculation_time = end-start calculation_time = end-start
print "\n\tCalculation time (2nd call)", calculation_time print "\n\tCalculation time (2nd call)", calculation_time
...@@ -269,7 +273,7 @@ return result ...@@ -269,7 +273,7 @@ return result
## 1st call ## 1st call
start = time.time() start = time.time()
original = my_cache(20000, portal_path=('', portal.getId())) original = my_cache(nb_iterations, portal_path=('', portal.getId()))
end = time.time() end = time.time()
calculation_time = end-start calculation_time = end-start
print "\n\tCalculation time (after cache clear)", calculation_time print "\n\tCalculation time (after cache clear)", calculation_time
......
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