Exemple #1
0
func BenchmarkSliceWrite1k(b *testing.B) {
	var data [1000]byte
	for i := 0; i < b.N; i++ {
		b := Slice(data[:0])
		for range data {
			b.WriteByte(0)
		}
	}
}
Exemple #2
0
func BenchmarkBytesBufferWrite1k(b *testing.B) {
	var data [1000]byte
	for i := 0; i < b.N; i++ {
		b := bytes.NewBuffer(data[:0])
		for range data {
			b.WriteByte(0)
		}
	}
}
Exemple #3
0
func BenchmarkBytesBufferWrite10_Def(b *testing.B) {
	var data [10]byte
	for i := 0; i < b.N; i++ {
		var b bytes.Buffer
		for range data {
			b.WriteByte(0)
		}
	}
}