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