perf(library): resolve album and genre file paths in one query

"Play this artist" awaited `GetAlbumTracks` inside a for loop — 13
sequential round trips for a 12-album artist — and every one of the
four sites doing that asked for whole track rows to read `FilePath`
off them. Five genres cost 6 MB across the IPC.

`GetFilePathsByAlbums(ids, libraryID)` and `GetFilePathsByGenres(names,
libraryID)` answer once and carry only the paths. Measured at 50 000
tracks: an artist 13 calls / 74.2 kB -> 2 / 19.2 kB, twenty albums
20 / 117.5 kB / 7.8 ms -> 1 / 26.0 kB / 1.7 ms, five genres
5 / 6 014 kB / 213 ms -> 1 / 1 291 kB / 32.6 ms, with the returned path
lists identical.

They return the paths grouped by album id or genre name rather than
flattened, because the caller owns the order — an album list is sorted
by name, not by id, and a flattened result would silently reorder a
queue — and because the album drag cache stores them per album. A
libraryID of 0 means "every library", matching an unset filter.
This commit is contained in:
2026-08-12 01:18:17 -04:00
parent 0cf710cf47
commit 9e0e4d5bb8
8 changed files with 625 additions and 0 deletions
+4
View File
@@ -43,6 +43,10 @@ export function GetAllTracks():Promise<Array<library.Track>>;
export function GetAllTracksByLibrary(arg1:number):Promise<Array<library.Track>>;
export function GetFilePathsByAlbums(arg1:Array<number>,arg2:number):Promise<Record<number, Array<string>>>;
export function GetFilePathsByGenres(arg1:Array<string>,arg2:number):Promise<Record<string, Array<string>>>;
export function GetRemovalImpact(arg1:number):Promise<library.RemovalImpact>;
export function GetScanQueueLength():Promise<number>;
+8
View File
@@ -78,6 +78,14 @@ export function GetAllTracksByLibrary(arg1) {
return window['go']['library']['Library']['GetAllTracksByLibrary'](arg1);
}
export function GetFilePathsByAlbums(arg1, arg2) {
return window['go']['library']['Library']['GetFilePathsByAlbums'](arg1, arg2);
}
export function GetFilePathsByGenres(arg1, arg2) {
return window['go']['library']['Library']['GetFilePathsByGenres'](arg1, arg2);
}
export function GetRemovalImpact(arg1) {
return window['go']['library']['Library']['GetRemovalImpact'](arg1);
}