(size uint32, b *testing.B)
| 779 | } |
| 780 | |
| 781 | func benchString(size uint32, b *testing.B) { |
| 782 | str := string(RandBytes(int(size))) |
| 783 | data := make([]byte, 0, len(str)+5) |
| 784 | data = AppendString(data, str) |
| 785 | rd := NewReader(NewEndlessReader(data, b)) |
| 786 | b.SetBytes(int64(len(data))) |
| 787 | b.ReportAllocs() |
| 788 | b.ResetTimer() |
| 789 | for i := 0; i < b.N; i++ { |
| 790 | _, err := rd.ReadString() |
| 791 | if err != nil { |
| 792 | b.Fatal(err) |
| 793 | } |
| 794 | } |
| 795 | } |
| 796 | |
| 797 | func benchStringAsBytes(size uint32, b *testing.B) { |
| 798 | str := string(RandBytes(int(size))) |
no test coverage detected
searching dependent graphs…