예제 #1
0
func BenchmarkBufio(b *testing.B) {
	var scratch [1024]byte
	for i := 0; i < b.N; i++ {
		a := bytes.NewBuffer(bytes.Repeat([]byte("a"), 10240))
		b := bufio.NewReader(a)
		b.Peek(4)
		b.Read(scratch[:])
		b.Read(scratch[:])
		b.Read(scratch[:])
		b.Read(scratch[:])
	}
}