This doesn't work:

func BenchmarkFilter3(b *testing.B) {
    data := buildOrginalData()
    data2 := make([]int, len(data))
    b.ResetTimer()
    for i := 0; i < b.N; i++ {
        b.StopTimer()
        copy(data2, data)
        b.StartTimer()
        _ = Filter3(data2)
    }
}

On Wednesday, July 7, 2021 at 11:28:13 AM UTC-4 tapi...@gmail.com wrote:

>
> For example, I don't want the time consumed for "copy(data2, data)" being 
> counted.
> How to achieve this?
>
> func BenchmarkFilter3(b *testing.B) {
>     data := buildOrginalData()
>     data2 := make([]int, len(data))
>     b.ResetTimer()
>     for i := 0; i < b.N; i++ {
>         copy(data2, data)
>         _ = Filter3(data2)
>     }
> }
>

-- 
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/42fd1278-d714-48bb-9836-ec5fb385b16an%40googlegroups.com.

Reply via email to