[mythtv] PATCH: Intelligent shuffle locks mythmusic for a long
time
Isaac Richards
ijr at po.cwru.edu
Mon Mar 10 10:22:43 EST 2003
On Sunday 09 March 2003 11:35 pm, Joseph A. Caputo wrote:
> I finally figured out that mythmusic wasn't crashing when I toggled the
> shuffle mode. It's just that when it cycled to "Intelligent" shuffle
> mode, it was taking 5 minutes to recompute the playlist. I made a few
> simple changes to make the playlist traversal more efficient; now it
> takes ~1 second :-)
>
> - Extracted "weight" computation into its own function (yes, it
> introduces a little function call overhead, but the cost is negligible
> and you never know when you might need to use it elsewhere)
> - Changed playlistorder and playlistweight to use QValueVector instead
> of QValueList. QValueList is not optimized for random access --
> internally it's a linked list, so random access costs O(n). This was
> really killing us when sorting or looping through a large playlist.
> QValueVector uses an internal array, so random access is done in
> constant time.
>
> If it looks okay Isaac, I would suggest this be committed 0.8.
Yup, looks good to me. I'm committing it now.
Thanks,
Isaac
More information about the mythtv-dev
mailing list