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
..
2018-05-04 22:45:58 +02:00
2018-04-22 21:40:33 +01:00
2018-05-08 18:35:47 +01:00
2018-04-30 20:53:23 +01:00
2018-04-22 21:40:33 +01:00
2018-04-22 21:40:33 +01:00
2018-05-04 22:45:58 +02:00
2017-10-24 10:16:03 +01:00