Debian Codegraph @

build/bench_test.go

raw symbols SCIP
1 package build
2
3 import (
4 "testing"
5 )
6
7 func BenchmarkKn(b *testing.B) {
8 g := Kn(100)
9 for i := 0; i < b.N; i++ {
10 g.Visit(0, func(w int, c int64) (skip bool) {
11 return
12 })
13 }
14 }
15
16 func BenchmarkComplement(b *testing.B) {
17 g := Empty(100).Complement()
18 for i := 0; i < b.N; i++ {
19 g.Visit(0, func(w int, c int64) (skip bool) {
20 return
21 })
22 }
23 }
24
25 func BenchmarkSubgraph(b *testing.B) {
26 g := Kn(1000).Subgraph(Range(0, 100))
27 for i := 0; i < b.N; i++ {
28 g.Visit(0, func(w int, c int64) (skip bool) {
29 return
30 })
31 }
32 }
33
34 func BenchmarkConnect(b *testing.B) {
35 g := Kn(50).Connect(0, Kn(50))
36 for i := 0; i < b.N; i++ {
37 g.Visit(0, func(w int, c int64) (skip bool) {
38 return
39 })
40 }
41 }
42
43 func BenchmarkJoin(b *testing.B) {
44 g := Kn(1).Join(Kn(100), AllEdges())
45 for i := 0; i < b.N; i++ {
46 g.Visit(0, func(w int, c int64) (skip bool) {
47 return
48 })
49 }
50 }
51
52 func BenchmarkCost(b *testing.B) {
53 g := Kn(100).AddCost(8)
54 for i := 0; i < b.N; i++ {
55 g.Visit(0, func(w int, c int64) (skip bool) {
56 return
57 })
58 }
59 }
60
61 func BenchmarkCostFunc(b *testing.B) {
62 g := Kn(100).AddCostFunc(Cost(8))
63 for i := 0; i < b.N; i++ {
64 g.Visit(0, func(w int, c int64) (skip bool) {
65 return
66 })
67 }
68 }
69
70 func BenchmarkDeleteNone(b *testing.B) {
71 g := Kn(100).Delete(NoEdges())
72 for i := 0; i < b.N; i++ {
73 g.Visit(0, func(w int, c int64) (skip bool) {
74 return
75 })
76 }
77 }
78
79 func BenchmarkDeleteOne(b *testing.B) {
80 g := Kn(100).Delete(Edge(3, 8))
81 for i := 0; i < b.N; i++ {
82 g.Visit(0, func(w int, c int64) (skip bool) {
83 return
84 })
85 }
86 }
87
88 func BenchmarkDeleteAll(b *testing.B) {
89 g := Kn(100).Delete(AllEdges())
90 for i := 0; i < b.N; i++ {
91 g.Visit(0, func(w int, c int64) (skip bool) {
92 return
93 })
94 }
95 }
96
97 func BenchmarkAddNone(b *testing.B) {
98 g := Kn(100).Add(NoEdges())
99 for i := 0; i < b.N; i++ {
100 g.Visit(0, func(w int, c int64) (skip bool) {
101 return
102 })
103 }
104 }
105
106 func BenchmarkAddOne(b *testing.B) {
107 g := Kn(100).Add(Edge(3, 8))
108 for i := 0; i < b.N; i++ {
109 g.Visit(0, func(w int, c int64) (skip bool) {
110 return
111 })
112 }
113 }
114
115 func BenchmarkAddAll(b *testing.B) {
116 g := Kn(100).Add(AllEdges())
117 for i := 0; i < b.N; i++ {
118 g.Visit(0, func(w int, c int64) (skip bool) {
119 return
120 })
121 }
122 }
123
124 func BenchmarkAddAllCache(b *testing.B) {
125 g := Specific(Kn(100).Add(AllEdges()))
126 for i := 0; i < b.N; i++ {
127 g.Visit(0, func(w int, c int64) (skip bool) {
128 return
129 })
130 }
131 }
132
133 func BenchmarkUnion(b *testing.B) {
134 g := Kn(100).Union(Kn(100))
135 for i := 0; i < b.N; i++ {
136 g.Visit(0, func(w int, c int64) (skip bool) {
137 return
138 })
139 }
140 }
141
142 func BenchmarkIntersect(b *testing.B) {
143 g := Kn(100).Intersect(Kn(100))
144 for i := 0; i < b.N; i++ {
145 g.Visit(0, func(w int, c int64) (skip bool) {
146 return
147 })
148 }
149 }
150
151 func BenchmarkTensor(b *testing.B) {
152 g := Kn(10).Tensor(Kn(10))
153 for i := 0; i < b.N; i++ {
154 g.Visit(0, func(w int, c int64) (skip bool) {
155 return
156 })
157 }
158 }
159
160 func BenchmarkCartesian(b *testing.B) {
161 g := Kn(50).Cartesian(Kn(50))
162 for i := 0; i < b.N; i++ {
163 g.Visit(0, func(w int, c int64) (skip bool) {
164 return
165 })
166 }
167 }