diff options
author | 2018-05-08 18:36:29 +0100 | |
---|---|---|
committer | 2018-05-08 18:36:29 +0100 | |
commit | 68b45f5377ff0c8661f987398e316f3acae4835d (patch) | |
tree | ea744740986e9faefe660ba7500276ec8f348d61 /request | |
parent | 565e4164071778d076a48ece1698a0cf66e7548b (diff) | |
download | coredns-68b45f5377ff0c8661f987398e316f3acae4835d.tar.gz coredns-68b45f5377ff0c8661f987398e316f3acae4835d.tar.zst coredns-68b45f5377ff0c8661f987398e316f3acae4835d.zip |
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
Diffstat (limited to 'request')
0 files changed, 0 insertions, 0 deletions