Added benchmark for MakeTrianglesData
This commit is contained in:
parent
159df28dcc
commit
9e6e6197dd
24
data_test.go
24
data_test.go
|
@ -6,6 +6,30 @@ import (
|
||||||
"github.com/faiface/pixel"
|
"github.com/faiface/pixel"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
func BenchmarkMakeTrianglesData(b *testing.B) {
|
||||||
|
tests := []struct {
|
||||||
|
name string
|
||||||
|
len int
|
||||||
|
}{
|
||||||
|
{
|
||||||
|
name: "Small slice",
|
||||||
|
len: 10,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "Large slice",
|
||||||
|
len: 10000,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, tt := range tests {
|
||||||
|
b.Run(tt.name, func(b *testing.B) {
|
||||||
|
for i := 0; i < b.N; i++ {
|
||||||
|
_ = pixel.MakeTrianglesData(tt.len)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func BenchmarkTrianglesData_Len(b *testing.B) {
|
func BenchmarkTrianglesData_Len(b *testing.B) {
|
||||||
tests := []struct {
|
tests := []struct {
|
||||||
name string
|
name string
|
||||||
|
|
Loading…
Reference in New Issue