MCPcopy
hub / github.com/tinylib/msgp / BenchmarkString_AsSlice

Function BenchmarkString_AsSlice

msgp/setof/generated_test.go:498–515  ·  view source on GitHub ↗
(b *testing.B)

Source from the content-addressed store, hash-verified

496}
497
498func BenchmarkString_AsSlice(b *testing.B) {
499 sizes := []int{10, 100, 1000}
500
501 for _, size := range sizes {
502 b.Run(fmt.Sprintf("%d", size), func(b *testing.B) {
503 set := make(String)
504 for i := 0; i < size; i++ {
505 set[fmt.Sprintf("val%d", i)] = struct{}{}
506 }
507
508 b.ReportAllocs()
509 b.ResetTimer()
510 for i := 0; i < b.N; i++ {
511 _ = set.AsSlice()
512 }
513 })
514 }
515}
516
517func BenchmarkString_FromSlice(b *testing.B) {
518 sizes := []int{10, 100, 1000}

Callers

nothing calls this directly

Calls 1

AsSliceMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…