Details
-
Bug
-
Status: Closed
-
Resolution: Fixed
-
7.0.0 M3
-
Tomcat 5 + PostgresSQL 9.1. Portal Master GIT ID: d80818dc84b05302af96832519229a1d95bec6bd.
-
6.2.x
-
Committed
-
2
Description
Background
Upon investigating a customer issue, I've found three problems in LayoutLister. LPS-36049 enhances its performance, but there are still areas of improvement.
- Method _createList() implements a DFS (Depth First Search) algorithm to traverse the layout tree recursively. As such it isn't feasible for very deep structures.
- Searching for matching layouts based on a parentLayoutId in method createList()_ is done in O(N) complexity.
- The LayoutView object which is created by method getLayoutView() is a good candidate for being cached in a request scoped Thread Local Cache.
With these improvement I could lower the execution time of _createList() (with 5000+ pages) from ~250ms to ~5ms.
Steps to reproduce
1) Create a site called BigSite.
2) Create ~1000 pages: 9 level deep tree, every node has 2 pages and there is one root node. Use attached Groovy script (remember to fill in groupId).
3) Without fix applied: execute attached script (Performance_422995.groovy remember to fill in groupId) multiple times. Write down execution times from the output.
- With fix applied:* execute attached script (Performance_422995_after_fix.groovy remember to fill in groupId) multiple times. Write down execution times from the output.
Executions times before the fix:
Start measuring layouts performance
Total time:35. Number of results:2049
Executions times after the fix (should be lower than before):
Start measuring layouts performance
Total time:16. Number of results:2049