Skip to main content
Version: 2.0.x

常用方法的基准性能测试: https://github.com/gogf/gf/v2/blob/master/errors/gerror/gerror_z_bench_test.go

$ go test *.go -bench=".*" -benchmem
goos: linux
goarch: amd64
Benchmark_New-4 1890454 589 ns/op 256 B/op 1 allocs/op
Benchmark_Newf-4 1569258 762 ns/op 324 B/op 3 allocs/op
Benchmark_Wrap-4 2012910 600 ns/op 256 B/op 1 allocs/op
Benchmark_Wrapf-4 1600197 749 ns/op 324 B/op 3 allocs/op
Benchmark_NewSkip-4 2009928 579 ns/op 256 B/op 1 allocs/op
Benchmark_NewSkipf-4 1578370 752 ns/op 324 B/op 3 allocs/op
Benchmark_NewCode-4 2060835 591 ns/op 256 B/op 1 allocs/op
Benchmark_NewCodef-4 1603306 752 ns/op 324 B/op 3 allocs/op
Benchmark_NewCodeSkip-4 2047794 584 ns/op 256 B/op 1 allocs/op
Benchmark_NewCodeSkipf-4 1524495 779 ns/op 324 B/op 3 allocs/op
Benchmark_WrapCode-4 1972147 603 ns/op 256 B/op 1 allocs/op
Benchmark_WrapCodef-4 1651316 735 ns/op 324 B/op 3 allocs/op