[PR #25179] perf(mobile): optimized album sorting #18107

Open
opened 2026-02-05 16:32:48 +03:00 by OVERLORD · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/immich-app/immich/pull/25179
Author: @YarosMallorca
Created: 1/10/2026
Status: 🔄 Open

Base: mainHead: perf/optimize-album-sort


📝 Commits (6)

  • ee23794 perf(mobile): optimized album sorting
  • 29ec28b Merge branch 'main' into perf/optimize-album-sort
  • 564287c refactor: add index & sql query
  • 1396915 fix: migration
  • d275d4f refactor: enum, ordering & list
  • 3ec1086 test: update album service tests

📊 Changes

12 files changed (+8425 additions, -119 deletions)

View changed files

mobile/drift_schemas/main/drift_schema_v16.json (+1 -0)
📝 mobile/lib/constants/enums.dart (+2 -0)
📝 mobile/lib/domain/services/remote_album.service.dart (+18 -38)
📝 mobile/lib/infrastructure/entities/remote_album_asset.entity.dart (+1 -0)
📝 mobile/lib/infrastructure/entities/remote_album_asset.entity.drift.dart (+4 -0)
📝 mobile/lib/infrastructure/repositories/db.repository.dart (+4 -1)
📝 mobile/lib/infrastructure/repositories/db.repository.drift.dart (+1 -0)
📝 mobile/lib/infrastructure/repositories/db.repository.steps.dart (+431 -0)
📝 mobile/lib/infrastructure/repositories/remote_album.repository.dart (+27 -19)
📝 mobile/test/domain/services/album.service_test.dart (+14 -61)
📝 mobile/test/drift/main/generated/schema.dart (+4 -0)
mobile/test/drift/main/generated/schema_v16.dart (+7918 -0)

📄 Description

Description

Optimizes _sortByNewestAsset and _sortByOldestAsset to improve performance.
Reduces the database operations from O(N \times M) to O(N \times \log M).

Fixes #25071

Please describe to which degree, if any, an LLM was used in creating this pull request.

LLM (Gemini 3 Pro) was used to determine the best DB queries.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/immich-app/immich/pull/25179 **Author:** [@YarosMallorca](https://github.com/YarosMallorca) **Created:** 1/10/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `perf/optimize-album-sort` --- ### 📝 Commits (6) - [`ee23794`](https://github.com/immich-app/immich/commit/ee23794625a9204a86e580afdc93ef54e209f100) perf(mobile): optimized album sorting - [`29ec28b`](https://github.com/immich-app/immich/commit/29ec28bdd1038d569827b24d6e634489da61e66a) Merge branch 'main' into perf/optimize-album-sort - [`564287c`](https://github.com/immich-app/immich/commit/564287c06b044af061b061e5f8b9b20dd8524008) refactor: add index & sql query - [`1396915`](https://github.com/immich-app/immich/commit/139691526946a8d02985a91686d81f98b8b1595d) fix: migration - [`d275d4f`](https://github.com/immich-app/immich/commit/d275d4f2487bc2a0b7c6b1498215170a03249913) refactor: enum, ordering & list - [`3ec1086`](https://github.com/immich-app/immich/commit/3ec10863d7bebce581eae363de92b7c7a3ddd515) test: update album service tests ### 📊 Changes **12 files changed** (+8425 additions, -119 deletions) <details> <summary>View changed files</summary> ➕ `mobile/drift_schemas/main/drift_schema_v16.json` (+1 -0) 📝 `mobile/lib/constants/enums.dart` (+2 -0) 📝 `mobile/lib/domain/services/remote_album.service.dart` (+18 -38) 📝 `mobile/lib/infrastructure/entities/remote_album_asset.entity.dart` (+1 -0) 📝 `mobile/lib/infrastructure/entities/remote_album_asset.entity.drift.dart` (+4 -0) 📝 `mobile/lib/infrastructure/repositories/db.repository.dart` (+4 -1) 📝 `mobile/lib/infrastructure/repositories/db.repository.drift.dart` (+1 -0) 📝 `mobile/lib/infrastructure/repositories/db.repository.steps.dart` (+431 -0) 📝 `mobile/lib/infrastructure/repositories/remote_album.repository.dart` (+27 -19) 📝 `mobile/test/domain/services/album.service_test.dart` (+14 -61) 📝 `mobile/test/drift/main/generated/schema.dart` (+4 -0) ➕ `mobile/test/drift/main/generated/schema_v16.dart` (+7918 -0) </details> ### 📄 Description ## Description Optimizes `_sortByNewestAsset` and `_sortByOldestAsset` to improve performance. Reduces the database operations from $O(N \times M)$ to $O(N \times \log M)$. Fixes #25071 ## Please describe to which degree, if any, an LLM was used in creating this pull request. LLM (Gemini 3 Pro) was used to determine the best DB queries. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
OVERLORD added the pull-request label 2026-02-05 16:32:48 +03:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: immich-app/immich#18107