Uploaded image for project: 'PUBLIC - Liferay Portal Community Edition'
  1. PUBLIC - Liferay Portal Community Edition
  2. LPS-86858

Inefficient check for embedded portlets if there are multiple embedded portlets on a page

    Details

    • Type: Bug
    • Status: Verified
    • Resolution: Unresolved
    • Affects Version/s: 7.0.X
    • Fix Version/s: None
    • Component/s: Core Infrastructure
    • Labels:
      None

      Description

      Currently, ThemeDisplay has the following code in order to check if a portlet is embedded, and cache the result of that check.

      return _portletEmbeddedMap.computeIfAbsent(
      	new EmbeddedPortletCacheKey(groupId, layout.getPlid(), portletId),
      	key -> layout.isPortletEmbedded(portletId, groupId));
      }
      

      The code for layout.isPortletEmbedded(portletId, groupId) has a short path which does nothing if no embedded portlets are found. However, if there is at least one embedded portlet, each call to Layout.isPortletEmbedded() will proceed to call Layout.getEmbeddedPortlets, which will clone each embedded portlet object for each check.

      In other words, if we have m embedded portlets and n portlets on the page, we will always execute m⋅n clone operations. As a specific example, if there are 3 embedded portlets, and a total of 10 portlets on the page, Liferay will perform 30 portlet clone operations when checking for embedded portlets.

      In master, the fix went in under commits for LPS-67992.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                support-lep@liferay.com SE Support
                Reporter:
                minhchau.dang Minhchau Dang
                Participants of an Issue:
                Recent user:
                Liferay JIRA Bot
              • Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Days since last comment:
                  50 weeks, 3 days ago

                  Packages

                  Version Package