Opened 19 years ago
Closed 19 years ago
#482 closed patch (fixed)
mythmusic uses bubble sort when sorting the MusicNode tree.
Reported by: | 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)
Change History (7)
Changed 19 years ago by
Attachment: | tree-sorting.patch added |
---|
comment:1 Changed 19 years ago by
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
Component: | mythtv → mythmusic |
---|
comment:4 Changed 19 years ago by
Resolution: | fixed |
---|---|
Status: | closed → reopened |
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.
Patch to switch from bubblesort to QPtrList::sort