Optimize playlist loading by hashing the tracklist if possible
Normally MediaPlaylist::trackChanged
would be called n^2 times, where n
is the number of tracks in your playlist. Instead, let's try to use the index
stored in a hashmap when possible.
This reduces start-up and playlist loading by several magnitudes, and it's especially noticeable if you have very big playlists.
TODO:
-
Ensure that every track data has a mapping (when applicable), it's currently not covered in all paths and I need to study the code a bit more. -
Support the optimized path on all data types, not just tracks. -
Moving/popping tracks is not supported.
I'm not very happy with the "let's just keep two containers in sync" approach, but I don't know of a better way yet.