(b *testing.B)
| 872 | } |
| 873 | |
| 874 | func BenchmarkStringToSliceByte(b *testing.B) { |
| 875 | b.StopTimer() |
| 876 | s := "hello world" |
| 877 | var bs []byte |
| 878 | if false { |
| 879 | b.Logf("bs = %s", bs) |
| 880 | } |
| 881 | |
| 882 | // benchmark |
| 883 | b.ReportAllocs() |
| 884 | b.StartTimer() |
| 885 | for i := 0; i < b.N; i++ { |
| 886 | bs = unsafe.Slice(unsafe.StringData(s), len(s)) |
| 887 | } |
| 888 | _ = bs |
| 889 | } |
| 890 | |
| 891 | func BenchmarkStringToCopy(b *testing.B) { |
| 892 | b.StopTimer() |
nothing calls this directly
no test coverage detected
searching dependent graphs…