-
-
Notifications
You must be signed in to change notification settings - Fork 32
/
bench_test.go
76 lines (71 loc) · 1.82 KB
/
bench_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
package gltf_test
import (
"testing"
"github.com/qmuntal/gltf"
)
func BenchmarkOpenASCII(b *testing.B) {
benchs := []struct {
name string
}{
{"testdata/AnimatedCube/glTF/AnimatedCube.gltf"},
{"testdata/BoxVertexColors/glTF/BoxVertexColors.gltf"},
{"testdata/Cameras/glTF/Cameras.gltf"},
{"testdata/Cube/glTF/Cube.gltf"},
{"testdata/EnvironmentTest/glTF/EnvironmentTest.gltf"},
{"testdata/OrientationTest/glTF/OrientationTest.gltf"},
{"testdata/Triangle/glTF/Triangle.gltf"},
{"testdata/TriangleWithoutIndices/glTF/TriangleWithoutIndices.gltf"},
}
for _, bb := range benchs {
b.Run(bb.name, func(b *testing.B) {
for i := 0; i < b.N; i++ {
_, err := gltf.Open(bb.name)
if err != nil {
b.Errorf("Open() error = %v", err)
return
}
}
})
}
}
func BenchmarkOpenEmbedded(b *testing.B) {
benchs := []struct {
name string
}{
{"testdata/BoxVertexColors/glTF-Embedded/BoxVertexColors.gltf"},
{"testdata/Cameras/glTF-Embedded/Cameras.gltf"},
{"testdata/OrientationTest/glTF-Embedded/OrientationTest.gltf"},
{"testdata/Triangle/glTF-Embedded/Triangle.gltf"},
{"testdata/TriangleWithoutIndices/glTF-Embedded/TriangleWithoutIndices.gltf"},
}
for _, bb := range benchs {
b.Run(bb.name, func(b *testing.B) {
for i := 0; i < b.N; i++ {
_, err := gltf.Open(bb.name)
if err != nil {
b.Errorf("Open() error = %v", err)
return
}
}
})
}
}
func BenchmarkOpenBinary(b *testing.B) {
benchs := []struct {
name string
}{
{"testdata/BoxVertexColors/glTF-Binary/BoxVertexColors.glb"},
{"testdata/OrientationTest/glTF-Binary/OrientationTest.glb"},
}
for _, bb := range benchs {
b.Run(bb.name, func(b *testing.B) {
for i := 0; i < b.N; i++ {
_, err := gltf.Open(bb.name)
if err != nil {
b.Errorf("Open() error = %v", err)
return
}
}
})
}
}