Improve TODOs performance
What does this MR do?
It tries to improve TODO list performance by making less queries to routes
table.
This improved performance from about 10000-11000 ms to about 7000 ms on my local data (performance depends on user authorised projects and their namespaces, count of routes, distribution of todos between users/projects). The difference on production should be even bigger as the query fetching a single route takes about 0.5 ms on my local db while it takes sometimes more then 5 ms on production db (source: http://profiler.gitlap.com/20170316/3b31bcaf-5972-4877-b314-40cd493e0151.txt.gz)
As described in the related issue we used includes(:namespace)
and for every single project (for filter dropdown) a route is fetched additionally. This was changed in this MR.
There is still space for improvements and I am working on it - for every single TODO we fetch 2-3 routes (for avatar, for user - these two could be probably combined and for task target).
This part might be a bit more complicated and I suggest creating another MR for it.
Does this MR meet the acceptance criteria?
-
Changelog entry added -
Documentation created/updated -
API support added - Tests
-
Added for this feature/bug -
All builds are passing
-
-
Conform by the merge request performance guides -
Conform by the style guides -
Branch has no merge conflicts with master
(if it does - rebase it please) -
Squashed related commits together