Commit 144f65d8 authored by Julien Muchembled's avatar Julien Muchembled

Revert [32869] because there may be legitime use of TransactionalVariable for view

But add warning about use of such caches to speed view requests.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@32922 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 3e9fb1ba
...@@ -33,7 +33,6 @@ import subprocess ...@@ -33,7 +33,6 @@ import subprocess
import transaction import transaction
from DateTime import DateTime from DateTime import DateTime
from Products.ERP5Type.TransactionalVariable import getTransactionalVariable
from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase
from zLOG import LOG from zLOG import LOG
from Products.ERP5Type.tests.utils import LogInterceptor from Products.ERP5Type.tests.utils import LogInterceptor
...@@ -181,11 +180,15 @@ class TestPerformance(ERP5TypeTestCase, LogInterceptor): ...@@ -181,11 +180,15 @@ class TestPerformance(ERP5TypeTestCase, LogInterceptor):
bar.setReference(bar.getRelativeUrl()) bar.setReference(bar.getRelativeUrl())
transaction.commit() transaction.commit()
self.tic() self.tic()
tv = getTransactionalVariable(None)
# Check performance # Check performance
before_view = time() before_view = time()
for x in xrange(100): for x in xrange(100):
tv.clear() # XXX: Note that we don't clean TransactionVariable cache and REQUEST
# before each call to 'view' requests. In reality, they would be
# always empty at the beginning of such requests.
# If you work to improve performance of 'view' requests using this
# kind of cache, make sure it is actually useful outside
# testPerformance.
bar.Bar_viewPerformance() bar.Bar_viewPerformance()
after_view = time() after_view = time()
req_time = (after_view - before_view)/100. req_time = (after_view - before_view)/100.
...@@ -244,7 +247,6 @@ class TestPerformance(ERP5TypeTestCase, LogInterceptor): ...@@ -244,7 +247,6 @@ class TestPerformance(ERP5TypeTestCase, LogInterceptor):
view_result = {} view_result = {}
tic_result = {} tic_result = {}
add_result = {} add_result = {}
tv = getTransactionalVariable(None)
# call view once to fill caches # call view once to fill caches
self.bar_module.BarModule_viewBarList() self.bar_module.BarModule_viewBarList()
# add object in bar module # add object in bar module
...@@ -270,7 +272,6 @@ class TestPerformance(ERP5TypeTestCase, LogInterceptor): ...@@ -270,7 +272,6 @@ class TestPerformance(ERP5TypeTestCase, LogInterceptor):
gc.collect() gc.collect()
before_form = time() before_form = time()
for x in xrange(100): for x in xrange(100):
tv.clear()
self.bar_module.BarModule_viewBarList() self.bar_module.BarModule_viewBarList()
after_form = time() after_form = time()
# store result # store result
...@@ -333,11 +334,9 @@ class TestPerformance(ERP5TypeTestCase, LogInterceptor): ...@@ -333,11 +334,9 @@ class TestPerformance(ERP5TypeTestCase, LogInterceptor):
title='Line 2') title='Line 2')
transaction.commit() transaction.commit()
self.tic() self.tic()
tv = getTransactionalVariable(None)
# Check performance # Check performance
before_view = time() before_view = time()
for x in xrange(100): for x in xrange(100):
tv.clear()
foo.Foo_viewProxyField() foo.Foo_viewProxyField()
after_view = time() after_view = time()
req_time = (after_view - before_view)/100. req_time = (after_view - before_view)/100.
...@@ -368,11 +367,9 @@ class TestPerformance(ERP5TypeTestCase, LogInterceptor): ...@@ -368,11 +367,9 @@ class TestPerformance(ERP5TypeTestCase, LogInterceptor):
title='Line %s' % i) title='Line %s' % i)
transaction.commit() transaction.commit()
self.tic() self.tic()
tv = getTransactionalVariable(None)
# Check performance # Check performance
before_view = time() before_view = time()
for x in xrange(100): for x in xrange(100):
tv.clear()
foo.Foo_view() foo.Foo_view()
after_view = time() after_view = time()
req_time = (after_view - before_view)/100. req_time = (after_view - before_view)/100.
......
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