Modify

Ticket #482 (closed patch: fixed)

Opened 7 years ago

Last modified 7 years ago

mythmusic uses bubble sort when sorting the MusicNode tree.

Reported by: eskil <myth@…> Owned by: ijr
Priority: minor Milestone: unknown
Component: mythmusic Version:
Severity: medium Keywords:
Cc: Ticket locked: no

Description

After building the tree, AllMusic::resync calls ::sortTree when then happily uses bubblesort, implemented three different places to sort the three. That's not good for performance.

Attachments

tree-sorting.patch (5.7 KB) - added by eskil <myth@…> 7 years ago.
Patch to switch from bubblesort to QPtrList::sort
compare-fix.patch (614 bytes) - added by eskil <myth@…> 7 years ago.
Fix to track compare method

Change History

Changed 7 years ago by eskil <myth@…>

Patch to switch from bubblesort to QPtrList::sort

comment:1 Changed 7 years ago by eskil <myth@…>

The attached patch changes metadata.h from using QPtrList<Metadata> and QPtrList<MusicNode?> to two classes, MetadataPtrList? and MusicNodePtrList?, inherited from the QPtrList. These two classes implement the ::compareItems method so the ::sort method (inherited from QPtrList) can be used for sorting.

See http://eskil.org/mythtv/patches/tree-sorting.txt for profile results. Conclusion is, that with my 29010 rows in musicmetadata, a display path of "splitartist artist title album" sorts in <1 secs instead of 5secs. More noticably, a path of "artist title album" descreases from 22secs to <1secs.

comment:2 Changed 7 years ago by kkuphal

  • Component changed from mythtv to mythmusic

comment:3 Changed 7 years ago by danielk

  • Status changed from new to closed
  • Resolution set to fixed

applied in [7585].

Changed 7 years ago by eskil <myth@…>

Fix to track compare method

comment:4 Changed 7 years ago by eskil <myth@…>

  • Status changed from closed to reopened
  • Resolution fixed deleted

Daniel, thanks for submitting, but your tightening of MetadataPtrList::compareItem is wrong, it causes descending sort.

I've attached a 1 line fix to make it ascending again.

comment:5 Changed 7 years ago by danielk

  • Status changed from reopened to closed
  • Resolution set to fixed

(In [7593]) Closes #482 again by applying second patch :)

View

Add a comment

Modify Ticket

Action
as closed
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.