Closed lookfirst closed 4 years ago
Thanks for some very useful code.
In Publish(), it does an append in order to prevent issues with removal.
append
I found a test suite that shows that copy is faster. The similar code would be BenchmarkAppendAlloc (645ns/op) vs. BenchmarkCopy (521ns/op).
copy
https://gist.github.com/xogeny/b819af6a0cf8ba1caaef
go test -bench=. goos: darwin goarch: amd64 BenchmarkAppend-12 1000000 1087 ns/op BenchmarkAppendAlloc-12 3000000 645 ns/op BenchmarkAppendAllocInline-12 3000000 508 ns/op BenchmarkCopy-12 5000000 521 ns/op PASS ok _/tmp/append_vs_copy 8.642s
Thank you!
Wow! I forgot I even wrote this code. lol
Thanks for some very useful code.
In Publish(), it does an
append
in order to prevent issues with removal.I found a test suite that shows that
copy
is faster. The similar code would be BenchmarkAppendAlloc (645ns/op) vs. BenchmarkCopy (521ns/op).https://gist.github.com/xogeny/b819af6a0cf8ba1caaef