A user reports extremely slow initial page loads of a view including the Latest Builds portlet (configured to 75 builds), on an installation with ~3000 jobs with ~10 builds per job.
Looking at LatestBuilds.getFinishedBuilds, it is clear why: this code entirely defeats the lazy-loading in 1.485+, by loading all builds records for the included jobs before sorting them. This seems unnecessary: you should be able to pick successively older builds of each job in parallel, starting with the latest, until you have determined the list of newest builds, without ever attempting to load older build records. I think the right algorithm is to create a priority queue, initially populated with the last build of each job; then loop for as many builds as must be displayed, each time extracting and displaying the latest build in the queue and then adding the previous build from the same job if there is one.
Since the algorithm is naturally iterative, it should really be done using ProgressiveRendering so that page rendering does not block on it and so that the task can be aborted in case the user navigates away before it is finished.