(b *testing.B)
| 118 | } |
| 119 | |
| 120 | func BenchmarkStringToBytes(b *testing.B) { |
| 121 | input := b.Name() |
| 122 | |
| 123 | b.Run("copy", func(b *testing.B) { |
| 124 | b.ReportAllocs() |
| 125 | |
| 126 | for i := 0; i < b.N; i++ { |
| 127 | _tmpBytes = []byte(input) |
| 128 | } |
| 129 | }) |
| 130 | |
| 131 | b.Run("unsafe", func(b *testing.B) { |
| 132 | b.ReportAllocs() |
| 133 | |
| 134 | for i := 0; i < b.N; i++ { |
| 135 | _tmpBytes = StringToBytes(input) |
| 136 | } |
| 137 | }) |
| 138 | } |
| 139 | |
| 140 | func BenchmarkBytesToString(b *testing.B) { |
| 141 | input := []byte(b.Name()) |
nothing calls this directly
no test coverage detected