Wiki page list is extremely slow to generate
Summary
The Wiki page list is extremely slow to generate.
Steps to reproduce
Create a project. Push https://gitlab.com/bgamari/ghc-wiki to the wiki. Access the wiki pages list (e.g. https://gitlab.staging.haskell.org/ghc/ghc/wikis/pages).
Example Project
https://gitlab.com/bgamari/ghc-wiki/wikis/git_access
Note that this is not a large Wiki, being significantly pared-down from the full GHC wiki.
What is the current bug behavior?
The page takes nearly 10 seconds to load.
What is the expected correct behavior?
The page should load nearly instantly.
Relevant logs and/or screenshots
None.
Output of checks
This happens on gitlab.com
Possible fixes
It's not terribly clear. I tried viewing the same Wiki outside of GitLab with Gollum (which I understand is what GitLab's wiki uses internally) and found that the pages list loads nearly instantly (in around 200 ms). Consequently I think we can rule out Gollum and this Rugged issue (as suggested in #57067 (closed))
I have found that the biggest contributor to the load time is not the number of pages but rather the number of commits in the repository. The reproduction above has been modified to squash most of the Wiki's history. Consequently there are only ~1000 commits instead of the 17000 which are in the full, unabridged history. When given the full history the pages list fails to load entirely. This is surprising as it shouldn't be necessary to traverse the revision history of the wiki to generate the page list.