Eliminate cached N+1 queries for projects in Issue API
In EE, we call Issue#supports_weight?
for each issue, which then calls
project&.feature_available?(:issue_weights)
. If the project is not
preloaded, this incurs additional overhead, as each individual Project
object has to be queried. This can lead to a significant performance hit.
In loading the CE project with 100 issues, this contributed to at least 22%
of the load time.
See https://gitlab.com/gitlab-org/gitlab-ce/issues/47031 for why testing this is a bit tricky.
Edited by Stan Hu