Guest User

Untitled

a guest
Nov 24th, 2017
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.72 KB | None | 0 0
  1. // An example benchmark to benchmark a query based on different inputs
  2. func Benchmark_GetProcessingCountForRegions(b *testing.B) {
  3.  
  4. benchmarks := []struct {
  5. region string
  6. }{
  7. {"EU"},
  8. {"US"},
  9. }
  10.  
  11. for _, bm := range benchmarks {
  12. b.Run(bm.region, func(bbb *testing.B) {
  13. for i := 0; i < bbb.N; i++ {
  14. taskDb.GetProcessingCountForRegion(bm.region)
  15. }
  16. })
  17.  
  18. }
  19. }
  20.  
  21. func GetProcessingCountForRegion(testingB *testing.B, region string) {
  22. for i := 0; i < testingB.N; i++ {
  23. taskDb.GetProcessingCountForRegion(region)
  24. }
  25. }
  26.  
  27. for _, bm := range benchmarks {
  28. b.Run(bm.region, GetProcessingCountForRegion(*b, bm.region))
  29. }
Add Comment
Please, Sign In to add comment