Limit projects loaded in UsersController

Everyone can contribute. Help move this issue forward while earning points, leveling up and collecting rewards.

https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/24690 adds UsersController#starred_projects, which can potentially load a significant number of projects into memory. UsersController#contributed_projects may actually be worse. From the performance bar:

image

On GitLab.com, the most stars anyone has is around 300:

gitlabhq_production=# select user_id, count(*) from users_star_projects group by user_id order by count desc limit 10;
 user_id | count
---------+-------
 2580049 |   336
 2158988 |   332
  410951 |   294
  141094 |   253
 1342622 |   180
 2242051 |   179
 1306032 |   163
 2456824 |   160
  375110 |   145
 2407907 |   142
(10 rows)

I think we'll want to: paginate/limit this query

On GitLab.com, loading the contributed projects this takes several seconds to load:

image

Edited by 🤖 GitLab Bot 🤖