From ecf12b269f69d49233b722a052d32818b81f5050 Mon Sep 17 00:00:00 2001 From: Deluan Date: Fri, 31 Jul 2026 17:49:04 -0400 Subject: [PATCH] test(artwork): drop the decodeArtwork benchmark It existed to capture the before/after baseline for the 128->100 thumbnail change, which it has served. As an ongoing guard it is misleading: a 1000x1000 JPEG decode is ~97% of the 15ms it measures, so the two encoders it would be reached for are ~2.6% of the signal. It reported a phantom 2.8% regression for the NRGBA thumbnail change that isolating the scaler disproved. The per-encoder benchmarks in blurhash/ and thumbhash/ cover the part that actually changes. --- core/artwork/processor_internal_bench_test.go | 39 ------------------- 1 file changed, 39 deletions(-) delete mode 100644 core/artwork/processor_internal_bench_test.go diff --git a/core/artwork/processor_internal_bench_test.go b/core/artwork/processor_internal_bench_test.go deleted file mode 100644 index 1c7cdb3e3..000000000 --- a/core/artwork/processor_internal_bench_test.go +++ /dev/null @@ -1,39 +0,0 @@ -package artwork - -import ( - "bytes" - "context" - "image" - "image/color" - "image/jpeg" - "testing" -) - -func benchJPEG(size int) []byte { - img := image.NewRGBA(image.Rect(0, 0, size, size)) - for y := range size { - for x := range size { - img.SetRGBA(x, y, color.RGBA{ - R: uint8(255 * x / size), G: uint8(255 * y / size), - B: uint8((x + y) * 255 / (2 * size)), A: 255, - }) - } - } - var buf bytes.Buffer - if err := jpeg.Encode(&buf, img, nil); err != nil { - panic(err) - } - return buf.Bytes() -} - -// BenchmarkDecodeArtwork measures the whole per-image cost the artwork worker pays. -func BenchmarkDecodeArtwork(b *testing.B) { - data := benchJPEG(1000) - ctx := context.Background() - b.ReportAllocs() - for b.Loop() { - if _, err := decodeArtwork(ctx, "bench", data); err != nil { - b.Fatal(err) - } - } -}