跳到主要内容
版本:2.8.x(Latest)

https://github.com/gogf/gf/v2/blob/master/container/gset/gset_z_bench_test.go

goos: linux
goarch: amd64
Benchmark_IntSet_Add-4 10000000 277 ns/op 8 B/op 0 allocs/op
Benchmark_IntSet_Contains-4 20000000 60.6 ns/op 0 B/op 0 allocs/op
Benchmark_IntSet_Remove-4 10000000 211 ns/op 0 B/op 0 allocs/op
Benchmark_AnySet_Add-4 5000000 312 ns/op 21 B/op 1 allocs/op
Benchmark_AnySet_Contains-4 30000000 68.2 ns/op 0 B/op 0 allocs/op
Benchmark_AnySet_Remove-4 5000000 267 ns/op 0 B/op 0 allocs/op
Benchmark_StrSet_Add-4 5000000 383 ns/op 20 B/op 1 allocs/op
Benchmark_StrSet_Contains-4 10000000 160 ns/op 7 B/op 0 allocs/op
Benchmark_StrSet_Remove-4 5000000 306 ns/op 7 B/op 0 allocs/op
Benchmark_Unsafe_IntSet_Add-4 10000000 258 ns/op 35 B/op 0 allocs/op
Benchmark_Unsafe_IntSet_Contains-4 20000000 146 ns/op 0 B/op 0 allocs/op
Benchmark_Unsafe_IntSet_Remove-4 10000000 173 ns/op 0 B/op 0 allocs/op
Benchmark_Unsafe_AnySet_Add-4 5000000 355 ns/op 41 B/op 1 allocs/op
Benchmark_Unsafe_AnySet_Contains-4 10000000 150 ns/op 0 B/op 0 allocs/op
Benchmark_Unsafe_AnySet_Remove-4 200000000 11.9 ns/op 0 B/op 0 allocs/op
Benchmark_Unsafe_StrSet_Add-4 5000000 486 ns/op 59 B/op 1 allocs/op
Benchmark_Unsafe_StrSet_Contains-4 5000000 298 ns/op 7 B/op 0 allocs/op
Benchmark_Unsafe_StrSet_Remove-4 10000000 158 ns/op 7 B/op 0 allocs/op