pacman_test.go 602 B

123456789101112131415161718192021
  1. package pacman
  2. import "testing"
  3. import "github.com/jguer/yay/util"
  4. func benchmarkSearch(search string, b *testing.B) {
  5. for n := 0; n < b.N; n++ {
  6. Search(search)
  7. }
  8. }
  9. func BenchmarkSearchSimpleTopDown(b *testing.B) {
  10. util.SortMode = TopDown
  11. benchmarkSearch("chromium", b)
  12. }
  13. func BenchmarkSearchComplexTopDown(b *testing.B) { util.SortMode = TopDown; benchmarkSearch("linux", b) }
  14. func BenchmarkSearchSimpleDownTop(b *testing.B) {
  15. util.SortMode = DownTop
  16. benchmarkSearch("chromium", b)
  17. }
  18. func BenchmarkSearchComplexDownTop(b *testing.B) { util.SortMode = DownTop; benchmarkSearch("linux", b) }