Test data is 29010 rows in musicmetadata. After each swap to another sort, I'll do six test run in which I time the sort and count the number of CPU cycles spent. ------------------------------------------------------------------------------- Testing path set to "splitartist artist title album" 1) Use clean source tree CPU: CPU with timer interrupt, speed 0 MHz (estimated) Profiling through timer interrupt samples cum. samples % cum. % symbol name 186 186 26.7241 26.7241 MusicNode::findRightNode(QStringList, Metadata*, unsigned int) 176 362 25.2874 52.0115 anonymous symbol from section .plt 92 454 13.2184 65.2299 MusicNode::sort() 41 495 5.8908 71.1207 QPtrListIterator::QPtrListIterator(QPtrList const&) 38 533 5.4598 76.5805 __i686.get_pc_thunk.bx 34 567 4.8851 81.4655 Metadata::LastPlayStr() 14 581 2.0115 83.4770 AllMusic::resync() 13 594 1.8678 85.3448 QPtrListIterator::~QPtrListIterator() 12 606 1.7241 87.0690 QPtrListIterator::operator++() 10 616 1.4368 88.5057 QPtrListIterator::current() const 9 625 1.2931 89.7989 Metadata::Rating() 6 631 0.8621 90.6609 Metadata::getField(QString const&, QString*) 6 637 0.8621 91.5230 QMapPrivate::insertSingle(int const&) 5 642 0.7184 92.2414 Metadata::Metadata(QString, QString, QString, QString, QString, QString, int, int, int, int, int, int, QString, bool) 4 646 0.5747 92.8161 Metadata::Track() 4 650 0.5747 93.3908 QMapPrivate::key(QMapNodeBase*) const 3 653 0.4310 93.8218 AllMusic::findRightNode(Metadata*, unsigned int) 3 656 0.4310 94.2529 Metadata::formatReplaceSymbols(QString const&) 3 659 0.4310 94.6839 Metadata::operator=(Metadata const&) 3 662 0.4310 95.1149 QPtrList::insert(unsigned int, MusicNode const*) 2 664 0.2874 95.4023 AllMusic::buildTree() 2 666 0.2874 95.6897 AllMusic::putCDOnTheListView(CDCheckItem*) 2 668 0.2874 95.9770 Metadata::areYouFinished(unsigned int, unsigned int, QString const&, QString const&) 2 670 0.2874 96.2644 Metadata::getField(QStringList const&, QString*, QString const&, QString const&, unsigned int) 2 672 0.2874 96.5517 Metadata::setCompilationFormatting(bool) 2 674 0.2874 96.8391 QMap::operator[](int const&) 2 676 0.2874 97.1264 QMapConstIterator::QMapConstIterator(QMapNode*) 2 678 0.2874 97.4138 QMapNode::QMapNode() 2 680 0.2874 97.7011 QMapPrivate::QMapPrivate(QMapPrivate const*) 2 682 0.2874 97.9885 QValueListPrivate::QValueListPrivate() 1 683 0.1437 98.1322 AllMusic::sortTree() 1 684 0.1437 98.2759 FieldSplitInfo::~FieldSplitInfo() 1 685 0.1437 98.4195 Metadata::FormatArtist() 1 686 0.1437 98.5632 Metadata::Playcount() 1 687 0.1437 98.7069 QMap::clear() 1 688 0.1437 98.8506 QMap::contains(int const&) const 1 689 0.1437 98.9943 QMap::find(int const&) const 1 690 0.1437 99.1379 QMapPrivate::end() const 11 691 0.1437 99.2816 QPtrList::count() const 1 692 0.1437 99.4253 QPtrList::at(unsigned int) 1 693 0.1437 99.5690 QPtrList::count() const 1 694 0.1437 99.7126 QPtrList::take(unsigned int) 1 695 0.1437 99.8563 QValueListNode::QValueListNode() 1 696 0.1437 100.000 global constructors keyed to _ZeqRK8MetadataS1_ sort took 6677663258 cycles, 5 secs 187086 usecs sort took 6606090940 cycles, 5 secs 142209 usecs sort took 6669177300 cycles, 5 secs 181767 usecs sort took 6701080976 cycles, 5 secs 201771 usecs sort took 6702554701 cycles, 5 secs 202695 usecs sort took 6675388432 cycles, 5 secs 185659 usecs average around 6671 Mcycles and 5.18secs 2) Use QPtrList::sort on top_nodes CPU: CPU with timer interrupt, speed 0 MHz (estimated) Profiling through timer interrupt samples cum. samples % cum. % symbol name 168 168 25.3012 25.3012 anonymous symbol from section .plt 161 329 24.2470 49.5482 MusicNode::findRightNode(QStringList, Metadata*, unsigned int) 89 418 13.4036 62.9518 MusicNode::sort() 54 472 8.1325 71.0843 MusicNode::getTitle() 35 507 5.2711 76.3554 __i686.get_pc_thunk.bx 30 537 4.5181 80.8735 QPtrListIterator::operator++() 20 557 3.0120 83.8855 QPtrListIterator::current() const 12 569 1.8072 85.6928 QPtrList::at(unsigned int) 11 580 1.6566 87.3494 QPtrList::count() const 9 589 1.3554 88.7048 QMapPrivate::find(int const&) const 8 597 1.2048 89.9096 AllMusic::resync() 7 604 1.0542 90.9639 QMapPrivate::insertSingle(int const&) 6 610 0.9036 91.8675 Metadata::setCompilationFormatting(bool) 5 615 0.7530 92.6205 Metadata::LastPlay() 4 619 0.6024 93.2229 AllMusic::intoTree(Metadata*) 4 623 0.6024 93.8253 Metadata::formatReplaceSymbols(QString const&) 4 627 0.6024 94.4277 Metadata::getField(QString const&, QString*) 3 630 0.4518 94.8795 AllMusic::findRightNode(Metadata*, unsigned int) 3 633 0.4518 95.3313 Metadata::Track() 3 636 0.4518 95.7831 Metadata::getField(QStringList const&, QString*, QString const&, QString const&, unsigned int) 3 639 0.4518 96.2349 QMapPrivate::insert(QMapNodeBase*, QMapNodeBase*, int const&) 3 642 0.4518 96.6867 QPtrList::insert(unsigned int, MusicNode const*) 2 644 0.3012 96.9880 Metadata::ID() 2 646 0.3012 97.2892 Metadata::Metadata(QString, QString, QString, QString, QString, QString, int, int, int, int, int, int, QString, bool) 2 648 0.3012 97.5904 Metadata::areYouFinished(unsigned int, unsigned int, QString const&, QString const&) 2 650 0.3012 97.8916 MusicNode::MusicNode(QString, QStringList, unsigned int) 2 652 0.3012 98.1928 QPtrList::take(unsigned int) 1 653 0.1506 98.3434 AllMusic::buildTree() 1 654 0.1506 98.4940 Metadata::FormatArtist() 1 655 0.1506 98.6446 Metadata::PlayCount() 1 656 0.1506 98.7952 MusicNodePtrList::MusicNodePtrList() 1 657 0.1506 98.9458 QMap::operator[](int const&) 1 658 0.1506 99.0964 QMapIterator::data() 1 659 0.1506 99.2470 QMapPrivate::key(QMapNodeBase*) const 1 660 0.1506 99.3976 QPtrList::at(unsigned int) 1 661 0.1506 99.5482 QPtrList::count() const 1 662 0.1506 99.6988 QPtrListIterator::QPtrListIterator(QPtrList const&) 1 663 0.1506 99.8494 QPtrListIterator::~QPtrListIterator() 1 664 0.1506 100.000 __static_initialization_and_destruction_0(int, int) sort took 6680836555 cycles, 5 secs 189077 usecs sort took 6666437452 cycles, 5 secs 180049 usecs sort took 6667800418 cycles, 5 secs 180903 usecs sort took 6670015900 cycles, 5 secs 182292 usecs sort took 6690272685 cycles, 5 secs 194994 usecs sort took 6681331920 cycles, 5 secs 189389 usecs average around 6676 Mcycles and 5.19secs 3) Use QPtrList::sort on my_subnodes CPU: CPU with timer interrupt, speed 0 MHz (estimated) Profiling through timer interrupt samples cum. samples % cum. % symbol name 157 157 33.4755 33.4755 MusicNode::findRightNode(QStringList, Metadata*, unsigned int) 107 264 22.8145 56.2900 anonymous symbol from section .plt 29 293 6.1834 62.4733 QPtrListIterator::operator++() 28 321 5.9701 68.4435 MusicNode::getTitle() 28 349 5.9701 74.4136 __i686.get_pc_thunk.bx 20 369 4.2644 78.6780 QPtrListIterator::current() const 13 382 2.7719 81.4499 AllMusic::findRightNode(Metadata*, unsigned int) 9 391 1.9190 83.3689 AllMusic::resync() 9 400 1.9190 85.2878 Metadata::getField(QString const&, QString*) 8 408 1.7058 86.9936 Metadata::Track() 8 416 1.7058 88.6994 QMapPrivate::find(int const&) const 7 423 1.4925 90.1919 QMapPrivate::insertSingle(int const&) 6 429 1.2793 91.4712 Metadata::LastPlay() 6 435 1.2793 92.7505 Metadata::formatReplaceSymbols(QString const&) 5 440 1.0661 93.8166 MusicNodePtrList::compareItems(void*, void*) 4 444 0.8529 94.6695 Metadata::ID() 4 448 0.8529 95.5224 Metadata::Metadata(QString, QString, QString, QString, QString, QString, int, int, int, int, int, int, QString, bool) 4 452 0.8529 96.3753 Metadata::setCompilationFormatting(bool) 2 454 0.4264 96.8017 MetadataPtrList::MetadataPtrList() 2 456 0.4264 97.2281 MusicNode::MusicNode(QString, QStringList, unsigned int) 2 458 0.4264 97.6546 QPtrListIterator::operator++() 1 459 0.2132 97.8678 AllMusic::buildTree() 1 460 0.2132 98.0810 AllMusic::intoTree(Metadata*) 1 461 0.2132 98.2942 Metadata::FormatArtist() 1 462 0.2132 98.5075 MusicNode::sort() 1 463 0.2132 98.7207 MusicNodePtrList::MusicNodePtrList() 1 464 0.2132 98.9339 QMap::insert(int const&, Metadata* const&, bool) 1 465 0.2132 99.1471 QMap::operator[](int const&) 1 466 0.2132 99.3603 QMapIterator::data() 1 467 0.2132 99.5736 QMapPrivate::key(QMapNodeBase*) const 1 468 0.2132 99.7868 QPtrList::append(Metadata const*) 1 469 0.2132 100.000 QPtrListIterator::QPtrListIterator(QPtrList const&) sort took 360978368 cycles, 0 secs 226350 usecs sort took 352168353 cycles, 0 secs 220824 usecs sort took 354943296 cycles, 0 secs 222564 usecs sort took 355142479 cycles, 0 secs 222688 usecs sort took 357221712 cycles, 0 secs 223992 usecs sort took 360559806 cycles, 0 secs 226085 usecs average around 356 MCycles and 0.224secs 4) Use QPtrList::sort on my_tracks CPU: CPU with timer interrupt, speed 0 MHz (estimated) Profiling through timer interrupt samples cum. samples % cum. % symbol name 148 148 31.1579 31.1579 MusicNode::findRightNode(QStringList, Metadata*, unsigned int) 120 268 25.2632 56.4211 anonymous symbol from section .plt 42 310 8.8421 65.2632 QPtrListIterator::operator++() 35 345 7.3684 72.6316 MusicNode::getTitle() 22 367 4.6316 77.2632 __i686.get_pc_thunk.bx 21 388 4.4211 81.6842 QPtrListIterator::current() const 13 401 2.7368 84.4211 AllMusic::resync() 10 411 2.1053 86.5263 QMapPrivate::insertSingle(int const&) 7 418 1.4737 88.0000 Metadata::getField(QString const&, QString*) 6 424 1.2632 89.2632 QMapPrivate::find(int const&) const 4 428 0.8421 90.1053 Metadata::FormatArtist() 4 432 0.8421 90.9474 Metadata::ID() 4 436 0.8421 91.7895 Metadata::formatReplaceSymbols(QString const&) 4 440 0.8421 92.6316 Metadata::getField(QStringList const&, QString*, QString const&, QString const&, unsigned int) 4 444 0.8421 93.4737 QMapPrivate::key(QMapNodeBase*) const 3 447 0.6316 94.1053 Metadata::PlayCount() 3 450 0.6316 94.7368 Metadata::setCompilationFormatting(bool) 3 453 0.6316 95.3684 MetadataPtrList::compareItems(void*, void*) 2 455 0.4211 95.7895 AllMusic::findRightNode(Metadata*, unsigned int) 2 457 0.4211 96.2105 Metadata::LastPlay() 2 459 0.4211 96.6316 Metadata::Metadata(QString, QString, QString, QString, QString, QString, int, int, int, int, int, int, QString, bool) 2 461 0.4211 97.0526 Metadata::Track() 2 463 0.4211 97.4737 QPtrList::append(Metadata const*) 2 465 0.4211 97.8947 QPtrListIterator::QPtrListIterator(QPtrList const&) 2 467 0.4211 98.3158 QPtrListIterator::~QPtrListIterator() 1 468 0.2105 98.5263 AllMusic::intoTree(Metadata*) 1 469 0.2105 98.7368 Metadata::areYouFinished(unsigned int, unsigned int, QString const&, QString const&) 1 470 0.2105 98.9474 MusicNode::MusicNode(QString, QStringList, unsigned int) 1 471 0.2105 99.1579 MusicNode::insert(Metadata*) 1 472 0.2105 99.3684 MusicNode::sort() 1 473 0.2105 99.5789 MusicNodePtrList::compareItems(void*, void*) 1 474 0.2105 99.7895 QMapPrivate::insert(QMapNodeBase*, QMapNodeBase*, int const&) 1 475 0.2105 100.000 QPtrListIterator::operator++() sort took 326394130 cycles, 0 secs 204662 usecs sort took 341537552 cycles, 0 secs 214158 usecs sort took 327922141 cycles, 0 secs 205620 usecs sort took 342272363 cycles, 0 secs 214619 usecs sort took 326004352 cycles, 0 secs 204417 usecs sort took 341306815 cycles, 0 secs 214013 usecs average around 334 Mcycles and 0.21secs ------------------------------------------------------------------------------- Testing path set to "artist title album": 1) Use clean source tree CPU: CPU with timer interrupt, speed 0 MHz (estimated) Profiling through timer interrupt samples cum. samples % cum. % symbol name 500 500 25.7069 25.7069 anonymous symbol from section .plt 422 922 21.6967 47.4036 AllMusic::sortTree() 277 1199 14.2416 61.6452 AllMusic::findRightNode(Metadata*, unsigned int) 192 1391 9.8715 71.5167 MusicNode::getTitle() 147 1538 7.5578 79.0746 __i686.get_pc_thunk.bx 122 1660 6.2725 85.3470 QPtrListIterator::operator++() 103 1763 5.2956 90.6427 QPtrListIterator::current() const 67 1830 3.4447 94.0874 QPtrList::at(unsigned int) 26 1856 1.3368 95.4242 QPtrList::count() const 9 1865 0.4627 95.8869 QPtrList::take(unsigned int) 8 1873 0.4113 96.2982 Metadata::Track() 7 1880 0.3599 96.6581 AllMusic::resync() 7 1887 0.3599 97.0180 MusicNode::findRightNode(QStringList, Metadata*, unsigned int) 7 1894 0.3599 97.3779 MusicNode::sort() 7 1901 0.3599 97.7378 QMapPrivate::insertSingle(int const&) 6 1907 0.3085 98.0463 Metadata::LastPlay() 6 1913 0.3085 98.3548 QMapPrivate::find(int const&) const 5 1918 0.2571 98.6118 QPtrList::insert(unsigned int, MusicNode const*) 4 1922 0.2057 98.8175 Metadata::ID() 4 1926 0.2057 99.0231 Metadata::Metadata(QString, QString, QString, QString, QString, QString, int, int, int, int, int, int, QString, bool) 3 1929 0.1542 99.1774 AllMusic::buildTree() 2 1931 0.1028 99.2802 AllMusic::intoTree(Metadata*) 2 1933 0.1028 99.3830 Metadata::PlayCount() 2 1935 0.1028 99.4859 Metadata::formatReplaceSymbols(QString const&) 2 1937 0.1028 99.5887 MusicNode::MusicNode(QString, QStringList, unsigned int) 2 1939 0.1028 99.6915 QMapPrivate::key(QMapNodeBase*) const 1 1940 0.0514 99.7429 Metadata::areYouFinished(unsigned int, unsigned int, QString const&, QString const&) 1 1941 0.0514 99.7943 QMapConstIterator::QMapConstIterator(QMapNode*) 1 1942 0.0514 99.8458 QMapPrivate::insert(QMapNodeBase*, QMapNodeBase*, int const&) 1 1943 0.0514 99.8972 QPtrList::take(unsigned int) 1 1944 0.0514 99.9486 QPtrListIterator::QPtrListIterator(QPtrList const&) 1 1945 0.0514 100.000 QPtrListIterator::~QPtrListIterator() sort took 34428298636 cycles, 22 secs 587518 usecs sort took 33635178012 cycles, 22 secs 90209 usecs sort took 34001483151 cycles, 22 secs 319893 usecs sort took 34421735366 cycles, 22 secs 583404 usecs sort took 34355567580 cycles, 22 secs 541914 usecs sort took 33839181398 cycles, 22 secs 218125 usecs average around 34113 Mcycles and 22.39secs 2) Use QPtrList::sort on top_nodes, my_subnodes and my_tracks CPU: CPU with timer interrupt, speed 0 MHz (estimated) Profiling through timer interrupt samples cum. samples % cum. % symbol name 284 284 25.5626 25.5626 AllMusic::findRightNode(Metadata*, unsigned int) 260 544 23.4023 48.9649 anonymous symbol from section .plt 142 686 12.7813 61.7462 MusicNode::getTitle() 118 804 10.6211 72.3672 QPtrListIterator::operator++() 116 920 10.4410 82.8083 QPtrListIterator::current() const 94 1014 8.4608 91.2691 __i686.get_pc_thunk.bx 16 1030 1.4401 92.7093 MusicNode::findRightNode(QStringList, Metadata*, unsigned int) 13 1043 1.1701 93.8794 AllMusic::resync() 9 1052 0.8101 94.6895 Metadata::ID() 7 1059 0.6301 95.3195 QMapPrivate::find(int const&) const 7 1066 0.6301 95.9496 QMapPrivate::insertSingle(int const&) 6 1072 0.5401 96.4896 Metadata::LastPlay() 6 1078 0.5401 97.0297 Metadata::setCompilationFormatting(bool) 6 1084 0.5401 97.5698 QMapPrivate::key(QMapNodeBase*) const 4 1088 0.3600 97.9298 Metadata::Metadata(QString, QString, QString, QString, QString, QString, int, int, int, int, int, int, QString, bool) 4 1092 0.3600 98.2898 Metadata::formatReplaceSymbols(QString const&) 3 1095 0.2700 98.5599 QMapPrivate::insert(QMapNodeBase*, QMapNodeBase*, int const&) 2 1097 0.1800 98.7399 AllMusic::intoTree(Metadata*) 2 1099 0.1800 98.9199 Metadata::Track() 2 1101 0.1800 99.0999 Metadata::getField(QStringList const&, QString*, QString const&, QString const&, unsigned int) 2 1103 0.1800 99.2799 MusicNodePtrList::compareItems(void*, void*) 2 1105 0.1800 99.4599 QPtrListIterator::operator++() 1 1106 0.0900 99.5500 AllMusic::buildTree() 1 1107 0.0900 99.6400 Metadata::FormatArtist() 1 1108 0.0900 99.7300 Metadata::getField(QString const&, QString*) 1 1109 0.0900 99.8200 MetadataPtrList::compareItems(void*, void*) 1 1110 0.0900 99.9100 MusicNode::insert(Metadata*) 1 1111 0.0900 100.000 MusicNodePtrList::MusicNodePtrList() sort took 426407937 cycles, 0 secs 267374 usecs sort took 435405372 cycles, 0 secs 273015 usecs sort took 420548669 cycles, 0 secs 263700 usecs sort took 431722161 cycles, 0 secs 270707 usecs sort took 434344464 cycles, 0 secs 272351 usecs sort took 423745489 cycles, 0 secs 265705 usecs average around 428 Mcycles and 0.267secs ------------------------------------------------------------------------------- Conclusion, a display path of "splitartist artist title album" sorts in <1 secs instead of 5secs. More noticably, a path of "artist title album" decreases from 22secs to <1secs.