github.com/wangyougui/gf/v2@v2.6.5/util/guid/guid_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/wangyougui/gf. 6 7 // go test *.go -bench=".*" 8 9 package guid_test 10 11 import ( 12 "testing" 13 14 "github.com/wangyougui/gf/v2/util/guid" 15 ) 16 17 func Benchmark_S(b *testing.B) { 18 b.RunParallel(func(pb *testing.PB) { 19 for pb.Next() { 20 guid.S() 21 } 22 }) 23 } 24 25 func Benchmark_S_Data_1(b *testing.B) { 26 b.RunParallel(func(pb *testing.PB) { 27 for pb.Next() { 28 guid.S([]byte("123")) 29 } 30 }) 31 } 32 33 func Benchmark_S_Data_2(b *testing.B) { 34 b.RunParallel(func(pb *testing.PB) { 35 for pb.Next() { 36 guid.S([]byte("123"), []byte("456")) 37 } 38 }) 39 }