Efficient path generation mechanism

There's a potential degradation in performance on endpoints that generate a lot of paths. We should look into finding a way to generate them in bulk efficiently.

Example:

https://gitlab.com/gitlab-org/gitlab-ce/issues/57487

Edited by Matija Čupić