More specifically, the last parameter (needzero) of mallocgc is not passed 
down to c.nextFree, which causes the memclrNoHeapPointers function is 
called twice in makeslicecopy if the slice size <= 32768.

On Wednesday, August 18, 2021 at 11:06:53 PM UTC-4 tapi...@gmail.com wrote:

> 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/8756b448-6718-4ee3-9f52-c83e2f606da8n%40googlegroups.com.

Reply via email to