[Coco] the final stage of optimization
Wayne Campbell
asa.rand at yahoo.com
Fri Nov 20 16:15:25 EST 2009
I googled quicksort. The wiki page is very informative. While reading it, I remembered how I wrote the sorts in DCom. They were based on quicksort. Because they were contained in separate procedures, I was able to use them recursively, and that's what made it work.
In decode, the sorts and searches are part of that procedure, and not separate. This rules out recursion, as I can't call decode repeatedly. But I did gain an understanding I didn't previously have. I need to deal with the records to be searched or sorted in groups. This will require extra code to determine if a split is required, and how to divide it. I'm reasonably certain that a n/2 division will be faster, but I may be able to have it do a n/4 division when the number of records becomes greater than a specific number.
I think that doing it this way will speed things up because it won't have to search every record to find a match. We'll see.
Thanks for the tip Steven. :)
Wayne
________________________________
From: Steven Hirsch <snhirsch at gmail.com>
To: CoCoList for Color Computer Enthusiasts <coco at maltedmedia.com>
Sent: Fri, November 20, 2009 4:00:50 AM
Subject: Re: [Coco] the final stage of optimization
On Thu, 19 Nov 2009, Wayne Campbell wrote:
> There has to be a better way. Can someone help me understand how to make my search and sort algorithms faster?
Google quicksort. On average, it will outperform what appears (from your description) to be a form of bubblesort.
--
--
Coco mailing list
Coco at maltedmedia.com
http://five.pairlist.net/mailman/listinfo/coco
More information about the Coco
mailing list