File tree Expand file tree Collapse file tree 2 files changed +27
-0
lines changed Expand file tree Collapse file tree 2 files changed +27
-0
lines changed Original file line number Diff line number Diff line change @@ -294,3 +294,15 @@ func DisableRandPool() {
294294 poolMu .Lock ()
295295 poolPos = randPoolSize
296296}
297+
298+ // UUIDs is a slice of UUID types.
299+ type UUIDs []UUID
300+
301+ // Strings returns a string slice containing the string form of each UUID in uuids.
302+ func (uuids UUIDs ) Strings () []string {
303+ var uuidStrs = make ([]string , len (uuids ))
304+ for i , uuid := range uuids {
305+ uuidStrs [i ] = uuid .String ()
306+ }
307+ return uuidStrs
308+ }
Original file line number Diff line number Diff line change @@ -733,3 +733,18 @@ func BenchmarkUUID_NewPooled(b *testing.B) {
733733 }
734734 })
735735}
736+
737+ func BenchmarkUUIDs_Strings (b * testing.B ) {
738+ uuid1 , err := Parse ("f47ac10b-58cc-0372-8567-0e02b2c3d479" )
739+ if err != nil {
740+ b .Fatal (err )
741+ }
742+ uuid2 , err := Parse ("7d444840-9dc0-11d1-b245-5ffdce74fad2" )
743+ if err != nil {
744+ b .Fatal (err )
745+ }
746+ uuids := UUIDs {uuid1 , uuid2 }
747+ for i := 0 ; i < b .N ; i ++ {
748+ uuids .Strings ()
749+ }
750+ }
You can’t perform that action at this time.
0 commit comments