Skip to content

perf(album): optimize duplicate file filtering - #3759

Merged
susnux merged 1 commit into
masterfrom
jtr/perf-album-dup-filtering
Aug 19, 2026
Merged

susnux merged 1 commit into
masterfrom
jtr/perf-album-dup-filtering

Conversation

@joshtrichards

Copy link
Copy Markdown
Member

Optimize duplicate filtering step used when combining manually added album files with smart-album results.

Changes:

  • Build an associative ID set from the existing album files.
  • Replace per-file array_search() scans with average O(1) lookups via isset().
  • Apply the optimization to both regular and shared album file merging.

Impact

Reduces the duplicate-filtering step from approximately O(n × m) to O(n + m) by avoiding a full scan of the existing file-ID list for each smart-album result. The per-file array_search() is replaced with an average O(1) associative-array lookup via isset() (where n is the number of existing album files and m is the number of smart-album results).

🤖 AI (if applicable)

  • The content of this PR was partly or fully generated using AI

Reduces the duplicate-filtering step from approximately O(n × m) to O(n + m) by avoiding a full scan of the existing file-ID list for each smart-album result. The per-file `array_search()` is replaced with an average O(1) associative-array lookup via `isset()` (where n is the number of existing album files and m is the number of smart-album results).

Assisted-by: Copilot:gpt-5.6-luna

Signed-off-by: Josh <josh.t.richards@gmail.com>
@joshtrichards joshtrichards added 3. to review Waiting for reviews performance 🚀 Performance issues and optimisations labels Aug 16, 2026
@joshtrichards
joshtrichards requested a review from artonge August 16, 2026 22:22
@susnux
susnux merged commit b27c42a into master Aug 19, 2026
50 checks passed
@susnux
susnux deleted the jtr/perf-album-dup-filtering branch August 19, 2026 09:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

3. to review Waiting for reviews performance 🚀 Performance issues and optimisations

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants