You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
perf: Add AppendProtocols for a an allocation free to get the protocols
While looking at Kubo benchmarks, if you are using connection filters you allocate ~200MiB/s in the Protocols code path.
This new method allows to give some preallocated memory in a slice, and it will be reused instead of allocating more.
```
goos: linux
goarch: amd64
pkg: github.com/multiformats/go-multiaddr
cpu: AMD Ryzen 5 3600 6-Core Processor
BenchmarkProtocols-12 3779694 312.0 ns/op 640 B/op 1 allocs/op
BenchmarkAppendProtocols-12 26105854 43.13 ns/op 0 B/op 0 allocs/op
```
0 commit comments