Beispiel #1
0
func BenchmarkSliceRead10(b *testing.B) {
	var data [10]byte
	for i := 0; i < b.N; i++ {
		b := Slice(data[:])
		for {
			if _, err := b.ReadByte(); err != nil {
				break
			}
		}
	}
}
Beispiel #2
0
func BenchmarkBytesBufferRead10(b *testing.B) {
	var data [10]byte
	for i := 0; i < b.N; i++ {
		b := bytes.NewBuffer(data[:])
		for {
			if _, err := b.ReadByte(); err != nil {
				break
			}
		}
	}
}
Beispiel #3
0
func BenchmarkBytesReader1k(b *testing.B) {
	var data [1000]byte
	for i := 0; i < b.N; i++ {
		b := bytes.NewReader(data[:])
		for {
			if _, err := b.ReadByte(); err != nil {
				break
			}
		}
	}
}