improve sprite.Draw(batch) benchmark
This commit is contained in:
parent
96f9ed3622
commit
dd1ddd15b3
|
@ -1,14 +1,17 @@
|
||||||
package pixel_test
|
package pixel_test
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"image"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/faiface/pixel"
|
"github.com/faiface/pixel"
|
||||||
)
|
)
|
||||||
|
|
||||||
func BenchmarkSpriteDrawBatch(b *testing.B) {
|
func BenchmarkSpriteDrawBatch(b *testing.B) {
|
||||||
sprite := pixel.NewSprite(nil, pixel.R(0, 0, 64, 64))
|
img := image.NewRGBA(image.Rect(0, 0, 64, 64))
|
||||||
batch := pixel.NewBatch(&pixel.TrianglesData{}, nil)
|
pic := pixel.PictureDataFromImage(img)
|
||||||
|
sprite := pixel.NewSprite(pic, pixel.R(0, 0, 64, 64))
|
||||||
|
batch := pixel.NewBatch(&pixel.TrianglesData{}, pic)
|
||||||
for i := 0; i < b.N; i++ {
|
for i := 0; i < b.N; i++ {
|
||||||
sprite.Draw(batch, pixel.IM)
|
sprite.Draw(batch, pixel.IM)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue