From 7c1911bbdaa3795a01a81970619f916867b46829 Mon Sep 17 00:00:00 2001 From: potassium5703 Date: Tue, 3 Sep 2024 19:49:27 +0300 Subject: [PATCH] genprof --- genprof | 2 ++ scale_test.go | 17 +++++++++-------- 2 files changed, 11 insertions(+), 8 deletions(-) create mode 100755 genprof diff --git a/genprof b/genprof new file mode 100755 index 0000000..0780930 --- /dev/null +++ b/genprof @@ -0,0 +1,2 @@ +go test -cpuprofile=profile.out -bench=BenchmarkSinglePixel && +go tool pprof -text profile.out diff --git a/scale_test.go b/scale_test.go index 09621cf..740b702 100644 --- a/scale_test.go +++ b/scale_test.go @@ -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) + } }