What does allocs/op and B/op mean in go benchmark?

前端 未结 1 636
野趣味
野趣味 2020-12-25 10:24

When I run my benchmarks with go test -v -bench=. -benchmem, I see the following results.

f1     10000        120860 ns/op        2433 B/op              


        
1条回答
  •  夕颜
    夕颜 (楼主)
    2020-12-25 11:01

    allocs/op means how many distinct memory allocations occurred per op (single iteration).

    B/op is how many bytes were allocated per op.

    0 讨论(0)
提交回复
热议问题