diff options
author | 2019-07-17 02:57:46 -0400 | |
---|---|---|
committer | 2019-07-17 06:57:46 +0000 | |
commit | a2af651ecb5565c495d8f670ee740045d188dd1e (patch) | |
tree | 9e1aa05daac6623aae6b4364a6e85155178dde83 /plugin/file/setup.go | |
parent | 21e9c6047b5bb4af4b798229828630fdfe633a7e (diff) | |
download | coredns-a2af651ecb5565c495d8f670ee740045d188dd1e.tar.gz coredns-a2af651ecb5565c495d8f670ee740045d188dd1e.tar.zst coredns-a2af651ecb5565c495d8f670ee740045d188dd1e.zip |
replacer: evaluate format once and improve perf by ~3x (#3002)
* replacer: evaluate format once and improve perf by ~3x
This improves the performance of logging by almost 3x and reduces memory
usage by ~8x.
Benchmark results:
benchmark old ns/op new ns/op delta
BenchmarkReplacer-12 644 324 -49.69%
BenchmarkReplacer_CommonLogFormat-12 4228 1471 -65.21%
benchmark old allocs new allocs delta
BenchmarkReplacer-12 8 2 -75.00%
BenchmarkReplacer_CommonLogFormat-12 51 17 -66.67%
benchmark old bytes new bytes delta
BenchmarkReplacer-12 240 48 -80.00%
BenchmarkReplacer_CommonLogFormat-12 3723 446 -88.02%
* replacer: code review comments
* bufPool: document why we use a pointer to a slice
* parseFormat: fix confusing comment
* TestParseFormat_Nodes: rename to TestParseFormatNodes
* replacer: use a value for bufPool instead of a pointer
* replacer: remove comment
* replacer: replace labels with knownLabels
The previous slice of label names is no longer needed.
Diffstat (limited to 'plugin/file/setup.go')
0 files changed, 0 insertions, 0 deletions