Bug 504864 - Info on slow startup with big playlist
Summary: Info on slow startup with big playlist
Status: CONFIRMED
Alias: None
Product: Elisa
Classification: Applications
Component: general (other bugs)
Version First Reported In: git-master
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: Matthieu Gallien
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2025-05-27 14:11 UTC by george fb
Modified: 2025-05-28 20:28 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed/Implemented In:
Sentry Crash Report:


Attachments
patch (7.23 KB, patch)
2025-05-27 14:11 UTC, george fb
Details

Note You need to log in before you can comment on or make changes to this bug.
Description george fb 2025-05-27 14:11:50 UTC
Created attachment 181779 [details]
patch

Been looking into improving the startup time and one thing that slows it down is the loop in `trackChanged`.

When opening Elisa `enqueueRestoredEntries` is called, 
which loops over the playlist items of the last instance to restore them, 
each item is added to `mData` and `newEntryInList` is emitted. 

After some signal/slot jumps we end up in `trackChanged` where we loop over all items of `mData`. 
This causes the startup to increase the more items are in the playlist.

One thing I thougt of is, in `enqueueRestoredEntries` when emitting `newEntryInList` also 
pass the index of item in `mData` so that we get that index in `trackChanged` thus avoiding the loop.
I implemented this in a not-so-nice way and it improves startup by a lot. 

With this change, starting Elisa while restoring a playlist with 9K items 
took 2 seconds vs 15 seconds with the loop, that's the time until the playlist is usable.

I opened this bug report because the code of `trackChanged` is very confusing
and as I don't use Elisa I'm not particularly eager to spend more time on it,
but still wanted to share this in case someone wants to look into this more.