photoprism/internal/meta/xmp_bench_test.go
Ömer Duran 86efc1c982
Index: Improve support for metadata in XMP sidecar files #2260 #2828 #5563
* Meta: Add XMP sidecar fixture corpus for reader rewrite #2260
* Meta: Replace XMP sidecar reader with antchfx/xmlquery #2260
* Meta: Add XMP sidecar reader test suite #2260
* Meta: Assert XMP GPS extraction on Apple/Adobe sidecars #2828
* Meta: Apply XMP sidecar metadata to photo and primary file #2260
* Meta: Resolve XMP sidecar time zone via shared helper #2260
* Meta: Derive panorama & caption keywords on XMP sidecar reads #2260
* Meta: Assert XMP sidecar GPS override and malformed-file handling #2260
* Meta: Tidy XMP sidecar reader comments and reuse logName local #2260
* Meta: Fix XMP sidecar capture-time priority OffsetTime handling #2260
* Meta: Address XMP sidecar review feedback #2260
2026-06-17 01:53:28 +02:00

45 lines
1.4 KiB
Go
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

package meta
import (
"testing"
)
// BenchmarkXMPRichSidecar measures per-file parse time on a fully
// populated Adobe Bridge sidecar (descriptive metadata, GPS, full
// camera/lens/exposure cluster, IDs). The proposal's performance
// budget is ≤ 2× the previous hand-rolled reader; running this with
// `go test -bench .` documents the new reader's absolute time so the
// budget can be reasoned about without re-introducing the old code.
func BenchmarkXMPRichSidecar(b *testing.B) {
for i := 0; i < b.N; i++ {
var data Data
if err := data.XMP("testdata/xmp/adobe/bridge.xmp"); err != nil {
b.Fatal(err)
}
}
}
// BenchmarkXMPMinimalSidecar measures the cheap path: a single-attribute
// fixture (F-Stop favorite). Sets a lower bound for how fast the loader
// + accessor pipeline can return when there is almost nothing to read.
func BenchmarkXMPMinimalSidecar(b *testing.B) {
for i := 0; i < b.N; i++ {
var data Data
if err := data.XMP("testdata/fstop-favorite.xmp"); err != nil {
b.Fatal(err)
}
}
}
// BenchmarkXMPMultiDescription measures the worst-case shape: four
// sibling rdf:Description blocks each declaring a different namespace
// binding. Catches regressions where the XPath walk degrades when
// properties scatter across blocks.
func BenchmarkXMPMultiDescription(b *testing.B) {
for i := 0; i < b.N; i++ {
var data Data
if err := data.XMP("testdata/xmp/synthetic/multi-rdf-description.xmp"); err != nil {
b.Fatal(err)
}
}
}