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 {
|
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) {
|
func BenchmarkScale(b *testing.B) {
|
||||||
for i := 0; i < b.N; i++ {
|
for i := 0; i < b.N; i++ {
|
||||||
err := png.Encode(io.Discard,
|
err := png.Encode(io.Discard,
|
||||||
Scale(Render(
|
Scale(Render(
|
||||||
texture.New(color.White, color.Black, 2),
|
texture.New(color.White,
|
||||||
|
color.Black, 2),
|
||||||
image.Rect(0, 0, 64, 64),
|
image.Rect(0, 0, 64, 64),
|
||||||
), 64),
|
), 64),
|
||||||
)
|
)
|
||||||
@ -48,11 +49,11 @@ func BenchmarkScale(b *testing.B) {
|
|||||||
|
|
||||||
func BenchmarkSinglePixel(b *testing.B) {
|
func BenchmarkSinglePixel(b *testing.B) {
|
||||||
instance := SinglePixel{}
|
instance := SinglePixel{}
|
||||||
err := png.Encode(io.Discard,
|
err := png.Encode(io.Discard,
|
||||||
Scale(instance, b.N),
|
Scale(instance, b.N),
|
||||||
)
|
)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user