Skip to content

Commit

Permalink
add benchmarks for Open
Browse files Browse the repository at this point in the history
  • Loading branch information
qmuntal committed Feb 20, 2019
1 parent c9d6ac4 commit 394a1f7
Showing 1 changed file with 72 additions and 0 deletions.
72 changes: 72 additions & 0 deletions bench_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
package gltf

import "testing"

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 := 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 := 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 := Open(bb.name)
if err != nil {
b.Errorf("Open() error = %v", err)
return
}
}
})
}
}

0 comments on commit 394a1f7

Please sign in to comment.