The portlet lookup (as opposed to the portlet rendering) done by PortletsTool?.getPortlets is slow and called many times when a page is rendered. Tests have shown that one can reduce the page rendering time from around 1/3 of a second by improving this part.
The PortletsTool?.getPortlets method has been modified in a branch with the aim of caching the portlet lookup :
http://svn.nuxeo.org/trac/pub/log/CPS3/products/CPSPortlets/branches/getPortletsCache/PortletsTool.py
This is just a first try at it and this needs to be finalized.
Things to be done
* Invalidate the cache at every portlet modification (createPortlet, deletePortlet, duplicatePortlet, movePortlet, insertPortlet). Maybe this could be simpler to plug the invalidation mechanism as an event subscriber.
* One should also think about the memory management (the 'rpath' parameter for example). JMO recommends a ZCacheable cache.
* JMO also recommends to deal with the other parameters (override, visibility_check, guard_check) otherwise the portlet editor might not work or more simply to not cache when visibility_check=False ou guard_check=False ou override=False ...