Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-40612

Poor performance of RelocationAction.getIconFileName

    XMLWordPrintable

    Details

    • Similar Issues:

      Description

      Encountered something like this in a thread dump:

      "Handling GET /job/.../job/.../job/.../view/All/ from ... : RequestHandlerThread[#...] View/index.jelly View/sidepanel.jelly AbstractFolder/tasks-bottom.jelly" ...
         java.lang.Thread.State: RUNNABLE
      	at java.lang.String$CaseInsensitiveComparator.compare(Unknown Source)
      	at java.lang.String.compareToIgnoreCase(Unknown Source)
      	at hudson.model.Items$2.compare(Items.java:360)
      	at hudson.model.Items$2.compare(Items.java:358)
      	at java.util.TimSort.countRunAndMakeAscending(Unknown Source)
      	at java.util.TimSort.sort(Unknown Source)
      	at java.util.Arrays.sort(Unknown Source)
      	at java.util.ArrayList.sort(Unknown Source)
      	at java.util.Collections.sort(Unknown Source)
      	at hudson.model.Items.getAllItems(Items.java:358)
      	at hudson.model.Items.getAllItems(Items.java:377)
      	at hudson.model.Items.getAllItems(Items.java:377)
      	at hudson.model.Items.getAllItems(Items.java:377)
      	at hudson.model.Items.getAllItems(Items.java:353)
      	at jenkins.model.Jenkins.getAllItems(Jenkins.java:1445)
      	at jenkins.model.Jenkins.getAllItems(Jenkins.java:1454)
      	at com.cloudbees.hudson.plugins.folder.relocate.StandardHandler.validDestinations(StandardHandler.java:85)
      	at com.cloudbees.hudson.plugins.folder.relocate.StandardHandler.applicability(StandardHandler.java:54)
      	at com.cloudbees.hudson.plugins.folder.relocate.DefaultRelocationUI.isAvailable(DefaultRelocationUI.java:67)
      	at com.cloudbees.hudson.plugins.folder.relocate.RelocationAction.getIconFileName(RelocationAction.java:90)
      

      This is silly. We are enumerating all items in the system, and sorting them, just so we can see if there is any place something could be moved into and thus whether we should display a Move link in the sidebar!

      To start with, the sort is unnecessary. Not sure if core APIs currently allow this to be optimized out. Then we should have a lazy iterator and break at the first valid destination; there is no need to collect them all.

      And perhaps we should just unconditionally display the link, at least if there is at least one top-level Folder in Jenkins. If there turns out to be no valid destination when you click the link, we can just show a message to that effect. No need to calculate all this in advance.

        Attachments

          Issue Links

            Activity

            jglick Jesse Glick created issue -
            recampbell Ryan Campbell made changes -
            Field Original Value New Value
            Labels performance
            jglick Jesse Glick made changes -
            Assignee Jesse Glick [ jglick ]
            jglick Jesse Glick made changes -
            Status Open [ 1 ] In Progress [ 3 ]
            jglick Jesse Glick made changes -
            Remote Link This issue links to "PR 110 (Web Link)" [ 17838 ]
            jglick Jesse Glick made changes -
            Status In Progress [ 3 ] In Review [ 10005 ]
            jglick Jesse Glick made changes -
            Link This issue is duplicated by JENKINS-45624 [ JENKINS-45624 ]
            jglick Jesse Glick made changes -
            Remote Link This issue links to "Page (Jenkins Wiki)" [ 17850 ]
            jglick Jesse Glick made changes -
            Status In Review [ 10005 ] Resolved [ 5 ]
            Resolution Fixed [ 1 ]
            cloudbees CloudBees Inc. made changes -
            Remote Link This issue links to "CloudBees Internal OSS-1769 (Web Link)" [ 18585 ]

              People

              • Assignee:
                jglick Jesse Glick
                Reporter:
                jglick Jesse Glick
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: