Opened 19 years ago

Closed 19 years ago

#482 closed patch (fixed)

mythmusic uses bubble sort when sorting the MusicNode tree.

Reported by: eskil <myth@…> Owned by: Isaac Richards
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 (2)

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

Download all attachments as: .zip

Change History (7)

Changed 19 years ago by eskil <myth@…>

Attachment: tree-sorting.patch added

Patch to switch from bubblesort to QPtrList::sort

comment:1 Changed 19 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 19 years ago by kkuphal

Component: mythtvmythmusic

comment:3 Changed 19 years ago by danielk

Resolution: fixed
Status: newclosed

applied in [7585].

Changed 19 years ago by eskil <myth@…>

Attachment: compare-fix.patch added

Fix to track compare method

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

Resolution: fixed
Status: closedreopened

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 19 years ago by danielk

Resolution: fixed
Status: reopenedclosed

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

Note: See TracTickets for help on using tickets.