mirror of
				https://github.com/coredns/coredns.git
				synced 2025-10-30 17:53:21 -04:00 
			
		
		
		
	plugin/cache: fix benchmark (#1758)
This commit is contained in:
		
							
								
								
									
										18
									
								
								plugin/cache/cache_test.go
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										18
									
								
								plugin/cache/cache_test.go
									
									
									
									
										vendored
									
									
								
							| @@ -231,15 +231,15 @@ func BenchmarkCacheResponse(b *testing.B) { | ||||
| 		reqs[i].SetQuestion(q+".example.org.", dns.TypeA) | ||||
| 	} | ||||
|  | ||||
| 	b.RunParallel(func(pb *testing.PB) { | ||||
| 		i := 0 | ||||
| 		for pb.Next() { | ||||
| 			req := reqs[i] | ||||
| 			c.ServeDNS(ctx, &test.ResponseWriter{}, req) | ||||
| 			i++ | ||||
| 			i = i % 5 | ||||
| 		} | ||||
| 	}) | ||||
| 	b.StartTimer() | ||||
|  | ||||
| 	j := 0 | ||||
| 	for i := 0; i < b.N; i++ { | ||||
| 		req := reqs[j] | ||||
| 		c.ServeDNS(ctx, &test.ResponseWriter{}, req) | ||||
| 		j++ | ||||
| 		j = j % 5 | ||||
| 	} | ||||
| } | ||||
|  | ||||
| func BackendHandler() plugin.Handler { | ||||
|   | ||||
		Reference in New Issue
	
	Block a user