If you are in a repository that can use sparse-checkout, then you can enable the sparse index using these commands:
git sparse-checkout init --cone --sparse-indext <dir1> <dir2> ... <dirN>
git sparse-checkout se
The size of the sparse index will scale with the number of files within your chosen directories, instead of the full size of your repository. When enabled with a number of other performance features, this can have a dramatic performance impact.