Quantcast
Channel: AutoIt v3 - General Help and Support
Viewing all articles
Browse latest Browse all 12506

What is the fastest way to sort a ListView?

$
0
0

I have been playing around with various methods to sort a listview with about 4000 rows and 5 columns. My problem is that to sort a listview using any of the methods I've tried are all painfully slow, or give inferior sort results.

 

Using the callback method of _GUICtrlListView_SortItems it takes about 30 seconds to sort the LV, but gives the best results.

 

Using _GUICtrlListView_SimpleSort, it takes anywhere from 20 to 30 seconds on the same list.

 

Plus with these first 2, I still have to rebuild the array that holds the contents of the listview so I can access the items correctly.

 

Using ArraySort and rebuilding the ListView gives the best results at around 6 seconds, but the results are the same as doing it with _SimpleSort (which makes sense as it just uses _ArraySort under the hood), but I don't have to rebuild the array I use to hold the LV items.

 

The problem with using the fastest method is that if I sort on more than one column after another, the results are all unsorted except for the last column sorted. An example, I'm using the listview in a media player, I want to have the song list showing the Track numbers in order, the Albums listed together, the Artist in alphabetical order, and the year of release in order. Using _GUICtrlListView_SortItems, I can sort each of those columns and when I sort the other columns those items stay in order, Track 2 comes after Track 1, all the albums are listed together, all the artists are listed alphabetically, and year of release is listed in order. But it takes me over 2.5 minutes to sort and rebuild the ListView to get it to sort this way.

 

So, I'm looking for something that sorts as well as SortItems, but isn't so dog slow. Any ideas? :)

 

 

EDIT: Changed the title to more along the lines of a question, rather than making it look like a statement.


Viewing all articles
Browse latest Browse all 12506

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>