Commit 7f920b14 authored by Jérome Perrin's avatar Jérome Perrin

xhtml_style: drop useless CachingMethod

This function have evolved to something very trivial not accessing anything from database, so caching this no longer really makes sense, also the cache keys are really big.

On a quick benchmark of calling ERP5Site_getTabList 10000 times:
with cache: ERP5Site_getTabList took 12.961781
without cache: ERP5Site_getTabList took 5.395873
parent 7c179dbd
from Products.ERP5Type.Cache import CachingMethod
def getTabList(status_dict, info_dict, add_all_tabs):
tab_list = []
basic_mode = status_dict.get('basic_mode', 1)
......@@ -68,10 +66,6 @@ if not add_all_tabs:
status_dict = context.ERP5Site_getConfiguredStatusDict()
info_dict = context.ERP5Site_getCategorizedModuleActionInformationDict()
getTabList = CachingMethod(getTabList, \
id = 'ERP5Site_getTabListInternal', \
cache_factory = 'erp5_ui_long')
return getTabList(status_dict = status_dict, \
info_dict = info_dict, \
add_all_tabs = add_all_tabs)
  • snippet used for that measurement:

     
    import time
    
    class timeblock:
      def __init__(self,descr=''):
        self.descr=descr
      def __enter__(self):
        self.t0=time.time()
        return self
      def __exit__(self, type_, value, traceback):
        self.t1=time.time()
        self.elapsed = self.t1-self.t0
      def __str__(self):
        return ('%s took %0.6f' % (self.descr, self.elapsed))
    
    
    ERP5Site_getTabList = context.ERP5Site_getTabList
    with timeblock("ERP5Site_getTabList") as t:
      for _ in range(10000):
        ERP5Site_getTabList()
    return str(t)
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