Spent some time on investigating this problem. It is confirmed that, when N == 16384, the memclrNoHeapPointers function is called twice in the Insert2 function. That means the "make+copy` optimization introduced in Go 1.15 will perform worse than the normal route under such situation.
On Wednesday, July 28, 2021 at 10:43:38 AM UTC-4 tapi...@gmail.com wrote: > > The benchmark code: https://play.golang.org/p/IqVnVa5x9qp > > When N == 16384, the benchmark result: > > Benchmark_Insert-4 134622 8032 ns/op 32768 B/op > 1 allocs/op > Benchmark_Insert2-4 132049 8201 ns/op 32768 B/op > 1 allocs/op > > When N == 16385, the benchmark result: > > Benchmark_Insert-4 118677 9374 ns/op 40960 B/op > 1 allocs/op > Benchmark_Insert2-4 136845 7744 ns/op 40960 B/op > 1 allocs/op > -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/8e32dd06-4b3c-435a-a452-5a26dec0a474n%40googlegroups.com.