Re: Sorting.
Posted in 1993
> From: indcon!rickt@4gen.UUCP > Subject: Sorting. > Date: Tue Sep 7 08:28:19 1993 > > I have an application that reads data, processes it and places > the resulting data into memory arrays(one dimensional) for display > to the screen. > Sometimes the array may have 8 rows filled or 800 rows filled, I don't > know the number until the process is done. > Do you think it would be faster to do a memory sort(ie interchange, > bubble, whatever) or write the data to temp table and read it > back in proper order. My concern is at what number of records(if any) > would the memory sort become slower than using a temp table. > > Machine is a RS6000/550, however many users are on the system. > > Rick Tucker > rickt%indcon@wybbs.mi.org > uunet!4gen!indcon!rickt In a theoretical sense, the memory sort will always be faster. Assuming that it is really IN memory (i.e. not so big as to need paging), your internal sort won't be doing any of the disk writes associated with using the temp table. Now, if this is using the 4GL (particularly RDS), then there may actually be a crossover in efficiency. It would depend on how much more efficient the Ultra-Advanced Super Tweaked Hand Tuned, Waxed, and Polished Informix sort is than your Generic K-Mart Blister Packed (10 for a dollar) built with Snap-Tite(tm) Lego Block 4GL :-). And then, that efficiency gained would have to counter act the disk I/O. So, basically, if you want to write your own sort, and you use a reasonable algorithm (I wouldn't suggest the bubble sort), the memory would probably be faster. However, I can't say if the performance gained by writing it is worth the PITA (Pain In The...Neck) Factor of writing, testing, and maintaining it compared to the TEMP table. Will (la4gen!villy@uunet.uu.net)