[futurebasic] Re: Sorting Hummms...

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : November 1997 : Group Archive : Group : All Groups

From: "L. Frank Turovich" <turovich@...>
Date: Mon, 10 Nov 97 20:36:18 -0500
>My guess is that you take a big speed hit when you have an INDEX$ and you
>ask for a specific element in it. I suspect somewhere in the compiler, it
>performs a search from the beginning the list and counts through the
>strings til it finds the element requested. And you do this enough time and
>you start to lose time because of this "searching" for the element. This I
>don't know for sure, but I suspect thats how it goes.

I too love the Combsort, but I know from testing experience that the 
QuickSort is still faster. Unfortunately, I can;t find my QS code to pass 
onto you to try.

Your speed really depends upon the INDEX$. You don't mention whether you 
are using fixed length strings for the INDEX$ array or not. If not, then 
INDEX$ is searching from the start to locate each element. If you convert 
it to a fixed string length, its a quick multiply to find the element, 
which should speed you up considerably. INDEX$ is simply a special 
function that uses a handle to hold the data elements. XREF is also a 
handle, but you lose all the INDEX$ niceties.

Try setting a fixed string length for your INDEX$ array, and do some 
tests. Should work out mucho better.

Happy coding -- Frank

BTW: Happy birthday Marines! 222 years of service to our fine country.

L. Frank Turovich                               turovich@...
Sentient Fruit                     http://home.earthlink.net/~turovich