Tracks view: windowed, server-sorted rows for very large libraries (deferred) #285

Open
opened 2026-10-06 02:40:30 +00:00 by yonlu · 1 comment
Owner

Deferred, filed so it is not lost (plan 023 step 6).

The Tracks view holds every track in memory so it can sort and filter on the client. With the compact table that is a few MB at 26k tracks and is fine. Somewhere past ~100k tracks it will not be.

The scalable shape is: count first, keyset-paginated rows for the viewport (SQL ORDER BY on the sort column), placeholders for unloaded windows in lit-virtualizer, filtering through the existing FTS (SearchTracks). The cost is that sort and filter become backend round-trips.

Do this when a measured library shows the compact table's decode or heap is the bottleneck — not before.

Deferred, filed so it is not lost (plan 023 step 6). The Tracks view holds every track in memory so it can sort and filter on the client. With the compact table that is a few MB at 26k tracks and is fine. Somewhere past ~100k tracks it will not be. The scalable shape is: count first, keyset-paginated rows for the viewport (SQL `ORDER BY` on the sort column), placeholders for unloaded windows in `lit-virtualizer`, filtering through the existing FTS (`SearchTracks`). The cost is that sort and filter become backend round-trips. Do this when a measured library shows the compact table's decode or heap is the bottleneck — not before.
Author
Owner

The measurement this issue asks for, taken on the 50 000-track bulk seed while landing #287:

  • Cold open of Tracks → first row: 1 255 ms.
  • A raw library.Library.GetTrackTable call for the same 50 000 rows: 1 118–1 382 ms.

So essentially none of the second is the TypeScript decode or the render — it is the Go-side query, the column encode, and Wails encoding every result twice for a debug log that is off (#286). That means the first thing to try here is not windowing: it is #286, which would halve the encode for every binding. Windowing is the answer once the payload is bigger than the time to transfer it, and at 10.45 MB (219 B/track) it is not there yet.

Also worth knowing before doing this: the prefetch on nav hover/focus (plan 023) hides most of that second for a pointer or keyboard user, so the case for windowing is a very large library on a slow device — an Android measurement would settle it better than this workstation did.

The measurement this issue asks for, taken on the 50 000-track bulk seed while landing #287: - Cold open of Tracks → first row: **1 255 ms**. - A *raw* `library.Library.GetTrackTable` call for the same 50 000 rows: **1 118–1 382 ms**. So essentially none of the second is the TypeScript decode or the render — it is the Go-side query, the column encode, and Wails encoding every result twice for a debug log that is off (#286). That means the first thing to try here is not windowing: it is #286, which would halve the encode for every binding. Windowing is the answer once the payload is bigger than the time to transfer it, and at 10.45 MB (219 B/track) it is not there yet. Also worth knowing before doing this: the prefetch on nav hover/focus (plan 023) hides most of that second for a pointer or keyboard user, so the case for windowing is a very large library on a slow device — an Android measurement would settle it better than this workstation did.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: yonlu/yellowjacket#285