Functions.getRelativeLinkTo(Item p) is called quite liberally while rendering Views. It calls view.getItems() which means recalculating the jobs to display. This can lead to performance problems for complex views (e.g. with the view-jobs-filter plugin).

      One idea is to cache the result from ListView.getItems(). Kohsuke created an initial branch for this:
      https://github.com/jenkinsci/jenkins/commits/view-caching

          [JENKINS-18364] Optimize creation of relative links to jobs

          Eric Weikl created issue -

          Eric Weikl added a comment - - edited

          Tested with the view-jobs-filter plugin, verified that Kohsuke's branch reduces the call count to ViewJobFilter.filter() to 1

          Eric Weikl added a comment - - edited Tested with the view-jobs-filter plugin , verified that Kohsuke's branch reduces the call count to ViewJobFilter.filter() to 1
          Jesse Glick made changes -
          Labels New: performance

          Jesse Glick added a comment -

          Unclear why getRelativeLinkTo is even needed in a typical page render, since View.getItem(String) does not care whether the item is actually in the current view anyway (and why would you be displaying an item not in the current view?). Quick workaround may be to use a weak cache of View.getItems by request (which might be useful anyway).

          Jesse Glick added a comment - Unclear why getRelativeLinkTo is even needed in a typical page render, since View.getItem(String) does not care whether the item is actually in the current view anyway (and why would you be displaying an item not in the current view?). Quick workaround may be to use a weak cache of View.getItems by request (which might be useful anyway).
          Jesse Glick made changes -
          Link New: This issue is related to JENKINS-20052 [ JENKINS-20052 ]
          Jesse Glick made changes -
          Assignee New: Jesse Glick [ jglick ]
          Jesse Glick made changes -
          Status Original: Open [ 1 ] New: In Progress [ 3 ]
          Jesse Glick made changes -
          Labels Original: performance New: lts-candidate performance

          Code changed in jenkins
          User: Jesse Glick
          Path:
          changelog.html
          core/src/main/java/hudson/Functions.java
          core/src/test/java/hudson/FunctionsTest.java
          http://jenkins-ci.org/commit/jenkins/bcc86148561ad9ab4a0365ff00d28ff7ee71d57c
          Log:
          [FIXED JENKINS-18364] Functions.getRelativeLinkTo is called many times during rendering, so skip checking View.getItems which is expensive.

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Jesse Glick Path: changelog.html core/src/main/java/hudson/Functions.java core/src/test/java/hudson/FunctionsTest.java http://jenkins-ci.org/commit/jenkins/bcc86148561ad9ab4a0365ff00d28ff7ee71d57c Log: [FIXED JENKINS-18364] Functions.getRelativeLinkTo is called many times during rendering, so skip checking View.getItems which is expensive.
          SCM/JIRA link daemon made changes -
          Resolution New: Fixed [ 1 ]
          Status Original: In Progress [ 3 ] New: Resolved [ 5 ]

            jglick Jesse Glick
            ericweikl Eric Weikl
            Votes:
            3 Vote for this issue
            Watchers:
            9 Start watching this issue

              Created:
              Updated:
              Resolved: