genprof
This commit is contained in:
parent
a49ce499e2
commit
7c1911bbda
2
genprof
Executable file
2
genprof
Executable file
@ -0,0 +1,2 @@
|
||||
go test -cpuprofile=profile.out -bench=BenchmarkSinglePixel &&
|
||||
go tool pprof -text profile.out
|
@ -29,14 +29,15 @@ func (s SinglePixel) ColorModel() color.Model {
|
||||
}
|
||||
|
||||
func (s SinglePixel) Bounds() image.Rectangle {
|
||||
return image.Rect(0,0,1,1)
|
||||
return image.Rect(0, 0, 1, 1)
|
||||
}
|
||||
|
||||
func BenchmarkScale(b *testing.B) {
|
||||
for i := 0; i < b.N; i++ {
|
||||
err := png.Encode(io.Discard,
|
||||
Scale(Render(
|
||||
texture.New(color.White, color.Black, 2),
|
||||
texture.New(color.White,
|
||||
color.Black, 2),
|
||||
image.Rect(0, 0, 64, 64),
|
||||
), 64),
|
||||
)
|
||||
@ -48,11 +49,11 @@ func BenchmarkScale(b *testing.B) {
|
||||
|
||||
func BenchmarkSinglePixel(b *testing.B) {
|
||||
instance := SinglePixel{}
|
||||
err := png.Encode(io.Discard,
|
||||
Scale(instance, b.N),
|
||||
)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
err := png.Encode(io.Discard,
|
||||
Scale(instance, b.N),
|
||||
)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user