BinaryBrain / Beetstream

Beets.io plugin that expose SubSonic API endpoints, allowing you to stream your music everywhere.
MIT License
35 stars 5 forks source link

AlbumList view query is very slow #12

Open gryphonmyers opened 1 year ago

gryphonmyers commented 1 year ago

The AlbumList view is quite slow to render, stemming from the fact that the handler pulls ALL albums out of the Beets DB then does pagination in memory. For large libraries, it is very noticeable how slow this is - trying to navigate a paginated view takes forever.

Solution - we can't do pagination using built-in Beets queries, but we can should be able to use lib.transaction to perform our own SQLite query. Instead of paginating in memory we would paginate with built-in sqlite limits and offsets.

BinaryBrain commented 1 year ago

Yes, I totally agree. I took some shortcut to have a working version but this is the kind of optimization I need to do next.

gryphonmyers commented 1 year ago

If I can find some time I am also willing to contribute