Revision 7211294d22e8b4f229174286ef7c8f05f99ead5a authored by Chris Tarazi on 26 April 2022, 00:39:09 UTC, committed by Jussi Mäki on 08 June 2022, 08:16:39 UTC
[ upstream commit 4c2c2446577d92fb15f0314efa487d77a6ce0812 ] Use strings.Builder instead of fmt.Sprintf() and preallocate the size of the string so that Go doesn't need to over-allocate if the string ends up longer than what the buffer growth algorithm predicts. Results: ``` $ go test -v -run '^$' -bench 'BenchmarkFQDNSelectorString' -benchmem ./pkg/policy/api > old.txt $ go test -v -run '^$' -bench 'BenchmarkFQDNSelectorString' -benchmem ./pkg/policy/api > new.txt $ benchcmp old.txt new.txt benchmark old ns/op new ns/op delta BenchmarkFQDNSelectorString-8 690 180 -73.97% benchmark old allocs new allocs delta BenchmarkFQDNSelectorString-8 9 4 -55.56% benchmark old bytes new bytes delta BenchmarkFQDNSelectorString-8 288 208 -27.78% ``` Signed-off-by: Chris Tarazi <chris@isovalent.com> Signed-off-by: Jussi Maki <jussi@isovalent.com>
1 parent 7702056
File | Mode | Size |
---|---|---|
.github | ||
.travis | ||
Documentation | ||
api | ||
bpf | ||
bugtool | ||
cilium | ||
cilium-health | ||
clustermesh-apiserver | ||
contrib | ||
daemon | ||
envoy | ||
examples | ||
hack | ||
hubble-relay | ||
images | ||
install | ||
jenkinsfiles | ||
operator | ||
pkg | ||
plugins | ||
proxylib | ||
test | ||
tests | ||
tools | ||
vendor | ||
.authors.aux | -rw-r--r-- | 416 bytes |
.gitattributes | -rw-r--r-- | 260 bytes |
.gitignore | -rw-r--r-- | 1.5 KB |
.gitmodules | -rw-r--r-- | 0 bytes |
.golangci.yaml | -rw-r--r-- | 3.3 KB |
.mailmap | -rw-r--r-- | 4.2 KB |
.travis.yml | -rw-r--r-- | 1.1 KB |
AUTHORS | -rw-r--r-- | 20.9 KB |
CHANGELOG.md | -rw-r--r-- | 169.0 KB |
CODEOWNERS | -rw-r--r-- | 592 bytes |
CODE_OF_CONDUCT.md | -rw-r--r-- | 2.2 KB |
CONTRIBUTING.md | -rw-r--r-- | 227 bytes |
FURTHER_READINGS.rst | -rw-r--r-- | 4.9 KB |
GO_VERSION | -rw-r--r-- | 8 bytes |
LICENSE | -rw-r--r-- | 11.1 KB |
MAINTAINERS.md | -rw-r--r-- | 3.6 KB |
Makefile | -rw-r--r-- | 28.3 KB |
Makefile.defs | -rw-r--r-- | 6.0 KB |
Makefile.docker | -rw-r--r-- | 6.1 KB |
Makefile.quiet | -rw-r--r-- | 718 bytes |
README.rst | -rw-r--r-- | 14.7 KB |
SECURITY.md | -rw-r--r-- | 615 bytes |
USERS.md | -rw-r--r-- | 6.8 KB |
VERSION | -rw-r--r-- | 8 bytes |
Vagrantfile | -rw-r--r-- | 12.8 KB |
go.mod | -rw-r--r-- | 5.6 KB |
go.sum | -rw-r--r-- | 130.6 KB |
netlify.toml | -rw-r--r-- | 92 bytes |
vagrant_box_defaults.rb | -rw-r--r-- | 392 bytes |
![swh spinner](/static/img/swh-spinner.gif)
Computing file changes ...