RE: Natural Sort - More speed Please

new topic     » topic index » view thread      » older message » newer message

> -----Original Message-----
> From: Tony Steward [mailto:tony at locksdownunder.com]

> How ever it is too slow. Would anyone like to try to optimize this 
> routine for greater speed. (As I have no idea how)

Actually, you should use nat_compare() rather than nat_sort().  You don't
need to sort the items, just do the comparison, since that's all windows
asks for (nat_sort() calls custom_sort() using nat_compare() for
comparisons):

global function LVnat_sort(integer id, integer item1, integer 
      item2, integer column)
    return nat_compare( getLVItemText(id, item1, column), 
                        getLVItemText(id, item2, column))
end function

The calls to getLVItemText() could be slowing you down, too.  This was the
reason that I originally coded win32lib to store the text of a listview
(IIRC).  It becomes a simple peek to get the item text, rather than asking
windows for a pointer and then peeking the string.

Matt Lewis

new topic     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu