github.com/gogf/gf@v1.16.9/util/gutil/gutil_z_bench_test.go (about) 1 // Copyright GoFrame Author(https://goframe.org). All Rights Reserved. 2 // 3 // This Source Code Form is subject to the terms of the MIT License. 4 // If a copy of the MIT was not distributed with this file, 5 // You can obtain one at https://github.com/gogf/gf. 6 7 // go test *.go -bench=".*" -benchmem 8 9 package gutil 10 11 import ( 12 "testing" 13 ) 14 15 var ( 16 m1 = map[string]interface{}{ 17 "k1": "v1", 18 } 19 m2 = map[string]interface{}{ 20 "k2": "v2", 21 } 22 ) 23 24 func Benchmark_TryCatch(b *testing.B) { 25 for i := 0; i < b.N; i++ { 26 TryCatch(func() { 27 28 }, func(err error) { 29 30 }) 31 } 32 } 33 34 func Benchmark_MapMergeCopy(b *testing.B) { 35 for i := 0; i < b.N; i++ { 36 MapMergeCopy(m1, m2) 37 } 38 }