https://bugs.kde.org/show_bug.cgi?id=504864

            Bug ID: 504864
           Summary: Info on slow startup with big playlist
    Classification: Applications
           Product: Elisa
      Version First git-master
       Reported In:
          Platform: Other
                OS: Linux
            Status: REPORTED
          Severity: normal
          Priority: NOR
         Component: general
          Assignee: matthieu_gall...@yahoo.fr
          Reporter: georgefb...@gmail.com
  Target Milestone: ---

Created attachment 181779
  --> https://bugs.kde.org/attachment.cgi?id=181779&action=edit
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.

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to