forked from qmuntal/gltf
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
72 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
} | ||
} | ||
}) | ||
} | ||
} |