authz: introduce benchmark for FilterActorPaths
Created by: keegancsmith
A customer using sub-repo permissions reported an issue with LsFiles timing out. After some investigation I have ruled out git as the root cause, and as such the other major component is the call to FilterActorPaths.
This commit adds a benchmark for FilterActorPaths, but with a few include and exclude patterns and lots of files. This is to try and capture the code that will typically be involved. The intention is to investigate profiles and improve the benchmark results.
Here are the results on my desktop machine:
$ go test -bench=Filter -run=^$ -benchmem
goos: linux
goarch: amd64
pkg: github.com/sourcegraph/sourcegraph/internal/authz
cpu: AMD Ryzen 9 5950X 16-Core Processor
BenchmarkFilterActorPaths-32 27 44682386 ns/op 111901 paths/s 4233714 B/op 72608 allocs/op
PASS
ok github.com/sourcegraph/sourcegraph/internal/authz 2.099s
The benchmark indicates about 100k paths per second. I suspect this is going a lot slower for the customer in question, but they have a much larger rules file. So after some initial optimization work we should likely replicate the size of the rules file.
Test Plan: n/a does not change any implementation only adds benchmark code.