tools/perf/build: Speed up auto-detection