package photos import ( "image" "testing" "time" ) func BenchmarkApplyLight(b *testing.B) { w, h := 4000, 3000 src := image.NewNRGBA(image.Rect(0, 0, w, h)) for i := range src.Pix { src.Pix[i] = uint8(i % 251) } p := LightParams{ Exposure: 0.5, Contrast: 20, Highlights: -30, Shadows: 40, Curve: CurveParams{ RGB: []CurvePoint{{X: 0, Y: 0}, {X: 0.5, Y: 0.4}, {X: 1, Y: 1}}, }, } b.ResetTimer() for i := 0; i < b.N; i++ { _ = applyLight(src, p) } b.StopTimer() b.Logf("кадров: %d", b.N) } func TestRenderSpeed(t *testing.T) { w, h := 4000, 3000 src := image.NewNRGBA(image.Rect(0, 0, w, h)) for i := range src.Pix { src.Pix[i] = uint8(i % 251) } start := time.Now() _ = applyLight(src, LightParams{Exposure: 0.5, Contrast: 20}) t.Logf("applyLight %dx%d: %s", w, h, time.Since(start)) }