Miek Gieben
							
						 
					 | 
					
						
						
							
						
						68b45f5377
					 | 
					
						
						
							
							plugin/cache: unroll minTTL loop (#1773)
						
						
						
						
						
						
						
						This allocates memory because of the append, just unroll the loop.
Also add benchmark.
Before:
goos: linux
goarch: amd64
pkg: github.com/coredns/coredns/plugin/cache
BenchmarkCacheResponse-4   	  100000	     11910 ns/op
BenchmarkMinMsgTTL-4       	 1000000	      1494 ns/op
PASS
After:
goos: linux
goarch: amd64
pkg: github.com/coredns/coredns/plugin/cache
BenchmarkCacheResponse-4   	  100000	     12016 ns/op
BenchmarkMinMsgTTL-4       	 2000000	       668 ns/op
PASS 
						
						
					 | 
					
						2018-05-08 18:36:29 +01:00 | 
					
					
						
						
						
							
							
							
							
							
							
							
							
						
					 |