mirror of
https://github.com/navidrome/navidrome.git
synced 2026-08-01 07:21:17 +00:00
test(thumbhash): drop the shipped-vs-reference benchmark
The two-pass rewrite's advantage over the naive port is already recorded in its commit message; carrying the benchmark to re-derive it has no ongoing use. reference_test.go stays: besides the benchmark baseline it holds the differential oracle the golden-vector and randomised specs assert against.
This commit is contained in:
parent
9084685fbc
commit
b13e8d7057
@ -1,36 +0,0 @@
|
||||
package thumbhash_test
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/navidrome/navidrome/core/artwork/thumbhash"
|
||||
"github.com/navidrome/navidrome/tests"
|
||||
)
|
||||
|
||||
// BenchmarkEncodeVsReference pins the two-pass separable encoder against the naive reference port
|
||||
// it replaced. referenceEncode is test-only, so this cannot live beside the cross-encoder
|
||||
// benchmark in core/artwork.
|
||||
func BenchmarkEncodeVsReference(b *testing.B) {
|
||||
const size = 100
|
||||
img := tests.GradientImage(size)
|
||||
pix := make([]byte, 0, size*size*4)
|
||||
for y := range size {
|
||||
pix = append(pix, img.Pix[y*img.Stride:y*img.Stride+size*4]...)
|
||||
}
|
||||
|
||||
b.Run("shipped", func(b *testing.B) {
|
||||
b.ReportAllocs()
|
||||
for b.Loop() {
|
||||
if _, err := thumbhash.Encode(img); err != nil {
|
||||
b.Fatal(err)
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
b.Run("reference", func(b *testing.B) {
|
||||
b.ReportAllocs()
|
||||
for b.Loop() {
|
||||
_ = referenceEncode(size, size, pix)
|
||||
}
|
||||
})
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user