-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
UI lags a long time when loading a rather big playlist #11724
Comments
I can confirm this. Tested with ~1k tracks, no noticeable delay, tested 12k tracks, whoops, still waiting for Ui to recover... |
same with or without cover art column (or just the |
nope, here 1 core is fully utilized. |
to clarify: |
I was curious and tried to find the significant difference in loading playlists vs. crates. mixxx/src/library/playlisttablemodel.cpp Lines 163 to 170 in e4b7307
required to fetch columns from both library and PlaylistTracks .And no table indices to speed it up. |
Nope, that wild guess was nonsense. The culprit is in mixxx/src/library/dao/playlistdao.cpp Lines 560 to 567 in 2d18ffe
If I revert these changes huge playlists are loaded instantly, so obviously the new query has a performance impact. I tried to detect if cleanup is needed by first checking whether the playlist includes hidden tracks but since I'm no SQL pro I fail to detect orpahend tracks (track ids in the |
I'm no SQL pro either, explain query plan might help here. My uneducated guess is that the performance hit is likely due to the nested |
Okay, so running id parent notused detail
3 0 0 SEARCH p1 USING INDEX idx_PlaylistTracks_playlist_id_track_id (playlist_id=?)
11 0 0 CORRELATED LIST SUBQUERY 1
14 11 0 SEARCH p2 USING COVERING INDEX idx_PlaylistTracks_playlist_id_track_id (playlist_id=?)
21 11 0 SEARCH library USING INTEGER PRIMARY KEY (rowid=?) So, since none of them use This is probably the source of the slowdown. |
Can you try changing the code to: query.prepare(QStringLiteral(
"SELECT p1.position FROM PlaylistTracks AS p1 "
"WHERE p1.id NOT IN ("
"SELECT p2.id FROM PlaylistTracks AS p2 "
"INNER JOIN library ON library.id=p2.track_id "
"WHERE p2.playlist_id=:id "
"AND library.mixxx_deleted=0) "
"AND p1.playlist_id=:id")); (the difference is only in the That removes the correlation and should allow for the same optimizations that made the query before 7993234 fast enough. |
Woooh, that fixes it! Thanks! However, I can't really test if this query removes orphaned tracks, because it seems this is done during startup already?? How I tested:
Same for hidden tracks:
|
@Swiftb0y Do you intend to open a PR, or should I do it (even though I can't explain why it is faster now)? |
Not sure either. To be honest I don't fully understand the query either, nor am I very familiar with mixxx's library infrastructure. But removing orphaned entries at startup is probably the better behavior.
I don't care either way. But I can open a PR and include a little bit of explanation why the query is faster while staying equivalent in the commit message. I didn't bother testing the change but you already seem to have done a thorough job doing so. |
Bug Description
Loading a 3k items playlist takes roughly a minute.
Meanwhile, UI is stuck and various controls like bas/mid/tre knobs do not respond as long as the UI is stuck.
2.3.x used to load these playlists within a second.
Did a tail -f ~/.mixxx/mixxx.log while loading a playlist and nothing came out, and no excessive cpu usage observed.
Setup used :
Version
2.4-beta
OS
DietPiOS (debian bullseye based)
The text was updated successfully, but these errors were encountered: