query_test.go 603 B

123456789101112131415161718192021222324252627
  1. package main
  2. import "testing"
  3. func benchmarkSearch(search string, b *testing.B) {
  4. for n := 0; n < b.N; n++ {
  5. queryRepo(append([]string{}, search))
  6. }
  7. }
  8. func BenchmarkSearchSimpleTopDown(b *testing.B) {
  9. config.SortMode = TopDown
  10. benchmarkSearch("chromium", b)
  11. }
  12. func BenchmarkSearchSimpleBottomUp(b *testing.B) {
  13. config.SortMode = BottomUp
  14. benchmarkSearch("chromium", b)
  15. }
  16. func BenchmarkSearchComplexTopDown(b *testing.B) {
  17. config.SortMode = TopDown
  18. benchmarkSearch("linux", b)
  19. }
  20. func BenchmarkSearchComplexBottomUp(b *testing.B) {
  21. config.SortMode = BottomUp
  22. benchmarkSearch("linux", b)
  23. }