-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathbowbuffer_test.go
More file actions
50 lines (43 loc) · 976 Bytes
/
Copy pathbowbuffer_test.go
File metadata and controls
50 lines (43 loc) · 976 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
package bow
import (
"fmt"
"testing"
"github.com/stretchr/testify/require"
)
func BenchmarkNewBufferFromInterfaces(b *testing.B) {
for rows := 10; rows <= 100000; rows *= 10 {
cells := make([]interface{}, rows)
for i := range cells {
cells[i] = int64(i)
}
b.Run(fmt.Sprintf("%d_rows", rows), func(b *testing.B) {
for n := 0; n < b.N; n++ {
_, err := NewBufferFromInterfaces(Int64, cells)
require.NoError(b, err)
}
})
}
}
func BenchmarkBuffer_SetOrDrop(b *testing.B) {
buf := NewBuffer(10, Int64)
b.ResetTimer()
for n := 0; n < b.N; n++ {
buf.SetOrDrop(9, int64(3))
buf.SetOrDrop(9, nil)
}
}
func BenchmarkBuffer_SetOrStrict(b *testing.B) {
buf := NewBuffer(10, Int64)
b.ResetTimer()
for n := 0; n < b.N; n++ {
buf.SetOrDropStrict(9, int64(3))
buf.SetOrDropStrict(9, nil)
}
}
func BenchmarkBuffer_GetValue(b *testing.B) {
buf := NewBuffer(10, Int64)
b.ResetTimer()
for n := 0; n < b.N; n++ {
_ = buf.GetValue(9)
}
}