Symbols: run the faster regex first
Created by: chrismwendt
Previously, the symbols service would always run the file regex then the symbol name regex. Some file regexes are pretty slow (e.g. (c|h|cpp|hpp)$
) compared to the symbol name regex (e.g. ^foo$
).
Now, the symbols service will run the symbol name regex first if it detects that it's fast (i.e. it starts with ^...
).
Locally, this makes symbol searches in the kubernetes/kubernetes repo go from 1.3s -> 0.9s. The filterSymbols
component of that time went from 0.5s -> 0.05s.
This is one of the improvements being discussed in https://github.com/sourcegraph/sourcegraph/issues/2257