Re: Sorting Hummms...
Quote from Forum Archives on November 10, 1997, 8:36 pmPosted by: turovich <turovich@...>
>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@earthlink.net
Sentient Fruit home.earthlink.net/~turovich
______________________________________________________________________
Posted by: turovich <turovich@...>
>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@earthlink.net
Sentient Fruit home.earthlink.net/~turovich
______________________________________________________________________