mirror of
https://github.com/stashapp/stash.git
synced 2026-03-31 10:32:36 +02:00
This update provides significant performance improvements for both image and scene duplicate searching: 1. Optimized the core Hamming distance algorithm in pkg/utils/phash.go: - Uses native CPU popcount instructions (math/bits) for bit counting. - Pre-calculates hash values to eliminate object allocations in the hot loop. - Halves the number of comparisons by leveraging the symmetry of the Hamming distance. - The loop is now several orders of magnitude faster and allocation-free. 2. Solved the N+1 database query bottleneck: - Replaced individual database lookups for each duplicate group with a single batched query for all duplicate IDs. - This optimization was applied to both Image and Scene repositories. 3. Simplified the SQL fast path for exact image matches to remove redundant table joins. |
||
|---|---|---|
| .. | ||
| boolean.go | ||
| date.go | ||
| date_test.go | ||
| doc.go | ||
| func.go | ||
| http.go | ||
| image.go | ||
| map.go | ||
| map_test.go | ||
| mutex.go | ||
| mutex_test.go | ||
| phash.go | ||
| reflect.go | ||
| reflect_test.go | ||
| resources.go | ||
| strings.go | ||
| strings_test.go | ||
| time.go | ||
| url.go | ||
| url_test.go | ||
| urlmap.go | ||
| urlmap_test.go | ||
| user_agent.go | ||
| vtt.go | ||
| vtt_test.go | ||