/
sexp_benchmark_test.go
99 lines (84 loc) · 2.31 KB
/
sexp_benchmark_test.go
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
package sexp
import "github.com/feyeleanor/lists"
import "github.com/feyeleanor/slices"
import "testing"
// Write benchmarks for Equal()
// Write benchmarks for Len()
// Write benchmarks for Cap()
// Write benchmarks for Each()
// Write benchmarks for Transform()
func BenchmarkReverseReversible(b *testing.B) {
s := slices.Slice{0, 1, 2, 3, 4, 5, 6, 7, 8, 9}
for i := 0; i < b.N; i++ {
Reverse(s)
}
}
func BenchmarkReverseIndexable(b *testing.B) {
s := indexable_slice{0, 1, 2, 3, 4, 5, 6, 7, 8, 9}
for i := 0; i < b.N; i++ {
Reverse(s)
}
}
func BenchmarkReverseReflected(b *testing.B) {
s := []int{0, 1, 2, 3, 4, 5, 6, 7, 8, 9}
for i := 0; i < b.N; i++ {
Reverse(s)
}
}
func BenchmarkDepthNested(b *testing.B) {
l := slices.Slice{0, slices.Slice{1, slices.Slice{2, slices.Slice{3, slices.Slice{4, slices.Slice{5, slices.Slice{}}}}}}}
for i := 0; i < b.N; i++ {
_ = Depth(l)
}
}
func BenchmarkDepthReflected(b *testing.B) {
s := []interface{}{0, []interface{}{1, []interface{}{2, []interface{}{3, []interface{}{4, []interface{}{5, []interface{}{}}}}}}}
for i := 0; i < b.N; i++ {
_ = Depth(s)
}
}
// Write benchmarks for Flatten()
// Write benchmarks for Append()
// Write benchmarks for AppendContainer()
// Write benchmarks for Prepend()
// Write benchmarks for PrependContainer()
func BenchmarkBlockCopyBlitter(b *testing.B) {
s := slices.Slice{0, 1, 2, 3, 4, 5, 6, 7, 8, 9}
for i := 0; i < b.N; i++ {
BlockCopy(s, 0, 5, 5)
}
}
func BenchmarkBlockCopyIndexable(b *testing.B) {
s := indexable_slice{0, 1, 2, 3, 4, 5, 6, 7, 8, 9}
for i := 0; i < b.N; i++ {
BlockCopy(s, 0, 5, 5)
}
}
func BenchmarkBlockCopyReflected(b *testing.B) {
s := []int{0, 1, 2, 3, 4, 5, 6, 7, 8, 9}
for i := 0; i < b.N; i++ {
BlockCopy(s, 0, 5, 5)
}
}
func BenchmarkBlockClearBlitter(b *testing.B) {
s := slices.Slice{0, 1, 2, 3, 4, 5, 6, 7, 8, 9}
for i := 0; i < b.N; i++ {
BlockClear(s, 0, 5)
}
}
func BenchmarkBlockClearIndexable(b *testing.B) {
l := lists.List(0, 1, 2, 3, 4, 5, 6, 7, 8, 9)
for i := 0; i < b.N; i++ {
BlockClear(l, 0, 5)
}
}
func BenchmarkBlockClearReflected(b *testing.B) {
s := []int{0, 1, 2, 3, 4, 5, 6, 7, 8, 9}
for i := 0; i < b.N; i++ {
BlockClear(s, 0, 5)
}
}
// Write benchmarks for Reallocate()
// Write benchmarks for Resize()
// Write benchmarks for Feed()
// Write benchmarks for Pipe()